void ServerApp::collocated_setup(void) { if (this->num_collocated_clients_ == 0) return; this->cb_servants_.create_and_activate(1, // number of callback servants this->cb_poa_.in()); CallbackServantListType::T_stub_var cb = this->cb_servants_.objref(0); unsigned client_id = this->num_remote_clients_; for (unsigned i = 0; i < this->num_collocated_clients_; i++) { client_id ++; // Dole out the servant object references in a round-robin fashion. unsigned servant_index = i % this->num_servants_; FooServantListType::T_stub_var foo = this->foo_servants_.objref(servant_index); ClientEngine_Handle engine = new Foo_B_ClientEngine(foo.in(), cb.in (), client_id, true); this->collocated_client_task_.add_engine(engine.in()); } }
void ServerApp::collocated_setup() { int custom_client_id_start = this->num_remote_clients_; unsigned servant_index = 0; for (unsigned i = 0; i < this->num_collocated_clients_; i++) { if (i > 0) { // Dole out the servant object references in a round-robin fashion. servant_index = (servant_index + 1) % this->num_servants_; } ServantListType::T_stub_var obj = this->servants_.objref(servant_index); ClientEngine_Handle engine = new Foo_C_Custom_ClientEngine(this->servants_.servant(servant_index), obj.in(), this->tp_strategy_.in(), ++ custom_client_id_start); this->collocated_client_task_.add_engine(engine.in()); } }
void ServerApp::collocated_setup() { int client_id_start = this->num_remote_clients_; for (unsigned i = 0; i < this->num_collocated_clients_; i++) { // Dole out the servant object references in a round-robin fashion. unsigned servant_index = i % this->num_servants_; ServantListType::T_stub_var obj = this->servants_.objref(servant_index); ClientEngine_Handle engine = new Foo_A_ClientEngine(obj.in(), ++client_id_start, true); this->collocated_client_task_.add_engine(engine.in()); } }
int ClientTask::svc() { ClientEngine_Handle engine; { ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, this->lock_, 0); this->engines_.get(engine, this->engines_.size() - 1); this->engines_.pop_back(); } try { bool exec_ret = engine->execute(); if (exec_ret == false) { ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, this->lock_, 0); this->failure_count_ ++; } } catch (const CORBA::Exception& ex) { ex._tao_print_exception ( "ClientTask::svc Caught exception from execute():"); ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, this->lock_, 0); this->failure_count_ ++; } catch (...) { ACE_ERROR((LM_ERROR, "(%P|%t) ClientTask::svc caught unknown (...) exception "\ "in execute() " )); ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, guard, this->lock_, 0); this->failure_count_ ++; } if(this->shutdown_after_done_) { // This is used to shutdown orb for a client application // with an orb running. TheAppShutdown->client_done (); } return 0; }
void ClientApp::client_setup(void) { // Turn the ior_ into a Foo_B obj ref. Foo_B_var foo = RefHelper<Foo_B>::string_to_ref(this->orb_.in(), this->ior_.c_str()); this->servants_.create_and_activate(1, // number of callback servants this->poa_.in()); ServantListType::T_stub_var cb = this->servants_.objref(0); // Create the ClientEngine object, and give it the Foo_B and Callback object // references. ClientEngine_Handle engine = new Foo_B_ClientEngine(foo.in(), cb.in (), this->client_id_); this->client_task_.add_engine(engine.in()); }