void ImR_Locator_i::kill_server (ImplementationRepository::AMH_AdministrationExtResponseHandler_ptr _tao_rh, const char * name, CORBA::Short signum) { Server_Info_Ptr si; if (!this->get_info_for_name (name, si)) { CORBA::Exception *ex = new ImplementationRepository::NotFound; ImplementationRepository::AMH_AdministrationExtExceptionHolder h (ex); _tao_rh->kill_server_excep (&h); return; } if (!si->alt_info_.null ()) { si = si->alt_info_; } UpdateableServerInfo info (this->repository_, si, true); if (info->is_mode(ImplementationRepository::PER_CLIENT)) { CORBA::Exception *ex = new ImplementationRepository::CannotComplete ("per-client server"); ImplementationRepository::AMH_AdministrationExtExceptionHolder h (ex); _tao_rh->kill_server_excep (&h); return; } Activator_Info_Ptr ainfo = this->get_activator (si->activator); if (ainfo.null ()) { CORBA::Exception *ex = new ImplementationRepository::CannotComplete ("no activator"); ImplementationRepository::AMH_AdministrationExtExceptionHolder h (ex); _tao_rh->kill_server_excep (&h); return; } ImplementationRepository::ActivatorExt_var actext = ImplementationRepository::ActivatorExt::_narrow (ainfo->activator.in()); if (CORBA::is_nil (actext.in())) { CORBA::Exception *ex = new ImplementationRepository::CannotComplete ("activator incompatible"); ImplementationRepository::AMH_AdministrationExtExceptionHolder h (ex); _tao_rh->kill_server_excep (&h); return; } if (!actext->kill_server (si->key_name_.c_str(), si->pid, signum)) { CORBA::Exception *ex = new ImplementationRepository::CannotComplete ("server not running"); ImplementationRepository::AMH_AdministrationExtExceptionHolder h (ex); _tao_rh->kill_server_excep (&h); } else { _tao_rh->kill_server (); AsyncAccessManager_ptr aam = this->find_aam (si->key_name_.c_str ()); if (!aam.is_nil ()) { aam->shutdown_initiated (); } } }
void ImR_Locator_i::shutdown_server (ImplementationRepository::AMH_AdministrationResponseHandler_ptr _tao_rh, const char* id) { const CORBA::ULong TAO_MINOR_MASK = 0x00000f80; if (debug_ > 0) ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) ImR: Shutting down server <%C>.\n"), id)); UpdateableServerInfo info (this->repository_, id); if (info.null ()) { ORBSVCS_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) ImR: shutdown_server () Cannot find info for server <%C>\n"), id)); CORBA::Exception *ex = new ImplementationRepository::NotFound; ImplementationRepository::AMH_AdministrationExceptionHolder h (ex); _tao_rh->shutdown_server_excep (&h); return; } this->connect_server (info); if (CORBA::is_nil (info->active_info()->server.in ())) { ORBSVCS_ERROR ((LM_ERROR, ACE_TEXT ("(%P|%t) ImR: shutdown_server () Cannot connect to server <%C>\n"), id)); CORBA::Exception *ex = new ImplementationRepository::NotFound; ImplementationRepository::AMH_AdministrationExceptionHolder h (ex); try { _tao_rh->shutdown_server_excep (&h); } catch (const CORBA::Exception &ex) { ex._tao_print_exception (ACE_TEXT ("reporting connect error\n")); } return; } try { CORBA::Object_var obj = this->set_timeout_policy (info->active_info()->server.in (), DEFAULT_SHUTDOWN_TIMEOUT); ImplementationRepository::ServerObject_var server = ImplementationRepository::ServerObject::_unchecked_narrow (obj.in ()); server->shutdown (); // reset the server info on a successful call. A failure indicates the server isn't // acting on the shutdown. Either it is shutting down already, or hasn't yet started, // in which case the shutdown will need to be reissued. info.edit ()->reset_runtime (); AsyncAccessManager_ptr aam = this->find_aam (info->ping_id ()); if (!aam.is_nil()) { aam->shutdown_initiated (); } } catch (const CORBA::TIMEOUT &ex) { info.edit ()->reset_runtime (); // Note : This is a good thing. It means we didn't waste our time waiting for // the server to finish shutting down. if (debug_ > 1) { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) ImR: Timeout while waiting for <%C> shutdown.\n"), id)); } ImplementationRepository::AMH_AdministrationExceptionHolder h (ex._tao_duplicate()); _tao_rh->shutdown_server_excep (&h); return; } catch (const CORBA::COMM_FAILURE& ex) { info.edit ()->reset_runtime (); if (debug_ > 1) { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("ImR: COMM_FAILURE while waiting for <%C> shutdown.\n"), id)); } if (this->opts_->throw_shutdown_exceptions ()) { ImplementationRepository::AMH_AdministrationExceptionHolder h (ex._tao_duplicate()); _tao_rh->shutdown_server_excep (&h); return; } } catch (const CORBA::TRANSIENT& ex) { CORBA::ULong minor = ex.minor () & TAO_MINOR_MASK; if (minor != TAO_POA_DISCARDING && minor != TAO_POA_HOLDING) { info.edit ()->reset_runtime (); } if (debug_ > 1) { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("ImR: TRANSIENT while waiting for <%C> shutdown.\n"), id)); } if (this->opts_->throw_shutdown_exceptions ()) { ImplementationRepository::AMH_AdministrationExceptionHolder h (ex._tao_duplicate()); _tao_rh->shutdown_server_excep (&h); return; } } catch (const CORBA::Exception &ex) { if (debug_ > 1) { ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) ImR: Exception while shutting down <%C>\n"), id)); } if (this->opts_->throw_shutdown_exceptions ()) { ImplementationRepository::AMH_AdministrationExceptionHolder h (ex._tao_duplicate()); _tao_rh->shutdown_server_excep (&h); return; } } _tao_rh->shutdown_server (); }