* Author: lamikr
*/
-//////////////////////////////////////////////////////////////////////
-
// A thread object used to server clients registered
// using the plpbus_orb::OrbServer::register() method.
+#include <plp/log.h>
+
#include "BusServer.hh"
#include "ServerEventThread.hh"
+
using namespace std;
using namespace plpbus;
ServerEventThread::ServerEventThread(plpbus_orb::OrbClient_ptr client,
- const char *msg,
- int period,
- OrbServerImpl *server_obj)
-{
+ const char *msg,
+ int period,
+ OrbServerImpl *server_obj) {
this->_orb_client = plpbus_orb::OrbClient::_duplicate(client);
this->_orb_msg = msg;
this->_interval = period;
_orb_client->receive_event_message("event_listener_started");
}
-void ServerEventThread::run(void* arg)
-{
+void ServerEventThread::run(void* arg) {
try {
while(_server_obj->is_shutdown_pending() == 0) {
omni_thread::sleep(_interval);
}
}
catch(...) {
- cout << "server_thread failed, could not connect to client!" << endl;
+ log_error("server_thread failed, could not connect to client!\n");
+ }
+ log_debug("server_thread, closing\n");
+ if (_server_obj != NULL) {
+ _server_obj->server_thread_closed();
}
- cout << "server_thread, closing" << endl;
- _server_obj->server_thread_closed();
}