diff options
-rw-r--r-- | TAO/tao/Exception.h | 10 | ||||
-rw-r--r-- | TAO/tao/Makefile | 21 | ||||
-rw-r--r-- | TAO/tao/ORB.cpp | 156 | ||||
-rw-r--r-- | TAO/tao/ORB.h | 15 | ||||
-rw-r--r-- | TAO/tao/ORB_Core.cpp | 168 | ||||
-rw-r--r-- | TAO/tao/ORB_Core.h | 24 | ||||
-rw-r--r-- | TAO/tao/ORB_Core.i | 31 | ||||
-rw-r--r-- | TAO/tao/params.cpp | 3 | ||||
-rw-r--r-- | TAO/tao/params.h | 25 | ||||
-rw-r--r-- | TAO/tao/params.i | 48 |
10 files changed, 276 insertions, 225 deletions
diff --git a/TAO/tao/Exception.h b/TAO/tao/Exception.h index 84d051c2873..2bd697bd743 100644 --- a/TAO/tao/Exception.h +++ b/TAO/tao/Exception.h @@ -268,11 +268,11 @@ TAO_SYSTEM_EXCEPTION(DATA_CONVERSION); // data conversion error TAO_SYSTEM_EXCEPTION(INV_POLICY); // invalid policies present TAO_SYSTEM_EXCEPTION(REBIND); // rebind needed TAO_SYSTEM_EXCEPTION(TIMEOUT); // operation timed out -TAO_SYSTEM_EXCEPTION(TRANSACTION_UNAVAILABLE); -TAO_SYSTEM_EXCEPTION(TRANSACTION_MODE); -TAO_SYSTEM_EXCEPTION(TRANSACTION_REQUIRED); // operation needs transaction -TAO_SYSTEM_EXCEPTION(TRANSACTION_ROLLEDBACK); // operation was a no-op -TAO_SYSTEM_EXCEPTION(INVALID_TRANSACTION); // invalid TP context passed +TAO_SYSTEM_EXCEPTION(TRANSACTION_UNAVAILABLE); // no transaction +TAO_SYSTEM_EXCEPTION(TRANSACTION_MODE); // invalid transaction mode +TAO_SYSTEM_EXCEPTION(TRANSACTION_REQUIRED); // operation needs transaction +TAO_SYSTEM_EXCEPTION(TRANSACTION_ROLLEDBACK); // operation was a no-op +TAO_SYSTEM_EXCEPTION(INVALID_TRANSACTION); // invalid TP context passed #undef TAO_SYSTEM_EXCEPTION diff --git a/TAO/tao/Makefile b/TAO/tao/Makefile index a2fb708f879..ed7e3d3b7be 100644 --- a/TAO/tao/Makefile +++ b/TAO/tao/Makefile @@ -7269,6 +7269,7 @@ realclean: $(ACE_ROOT)/ace/Select_Reactor_T.i \ $(ACE_ROOT)/ace/Select_Reactor.i \ $(ACE_ROOT)/ace/FlReactor.h \ + $(ACE_ROOT)/ace/TkReactor.h \ $(ACE_ROOT)/ace/Msg_WFMO_Reactor.h \ $(ACE_ROOT)/ace/Msg_WFMO_Reactor.i \ $(ACE_ROOT)/ace/TP_Reactor.h \ @@ -11086,8 +11087,7 @@ realclean: $(TAO_ROOT)/tao/Environment.h \ $(TAO_ROOT)/tao/Environment.i \ $(TAO_ROOT)/tao/Any.h \ - $(TAO_ROOT)/tao/Any.i \ - DomainC.i \ + $(TAO_ROOT)/tao/Any.i DomainC.i \ $(TAO_ROOT)/tao/Operation_Table.h \ $(ACE_ROOT)/ace/Hash_Map_Manager.h \ $(ACE_ROOT)/ace/Functor.h \ @@ -11227,9 +11227,8 @@ realclean: $(TAO_ROOT)/tao/Environment.i \ $(TAO_ROOT)/tao/Object.h \ $(TAO_ROOT)/tao/Object.i \ - $(TAO_ROOT)/tao/Any.i \ - TimeBaseC.i TimeBaseS.h TimeBaseS_T.h TimeBaseS_T.i TimeBaseS_T.cpp \ - TimeBaseS.i + $(TAO_ROOT)/tao/Any.i TimeBaseC.i \ + TimeBaseS.h TimeBaseS_T.h TimeBaseS_T.i TimeBaseS_T.cpp TimeBaseS.i .obj/TimeBaseS.o .obj/TimeBaseS.so .shobj/TimeBaseS.o .shobj/TimeBaseS.so: TimeBaseS.cpp TimeBaseS.h TimeBaseC.h \ $(TAO_ROOT)/tao/Any.h \ $(TAO_ROOT)/tao/CDR.h \ @@ -11303,8 +11302,8 @@ realclean: $(TAO_ROOT)/tao/Environment.i \ $(TAO_ROOT)/tao/Object.h \ $(TAO_ROOT)/tao/Object.i \ - $(TAO_ROOT)/tao/Any.i \ - TimeBaseC.i TimeBaseS_T.h TimeBaseS_T.i TimeBaseS_T.cpp TimeBaseS.i + $(TAO_ROOT)/tao/Any.i TimeBaseC.i \ + TimeBaseS_T.h TimeBaseS_T.i TimeBaseS_T.cpp TimeBaseS.i .obj/Principal.o .obj/Principal.so .shobj/Principal.o .shobj/Principal.so: Principal.cpp \ $(TAO_ROOT)/tao/Principal.h \ $(TAO_ROOT)/tao/corbafwd.h \ @@ -15000,7 +14999,8 @@ realclean: $(ACE_ROOT)/ace/Dynamic_Service.h \ $(ACE_ROOT)/ace/Dynamic_Service.cpp \ $(TAO_ROOT)/tao/Leader_Follower.h \ - $(TAO_ROOT)/tao/Leader_Follower.i + $(TAO_ROOT)/tao/Leader_Follower.i \ + $(TAO_ROOT)/tao/debug.h .obj/params.o .obj/params.so .shobj/params.o .shobj/params.so: params.cpp \ $(TAO_ROOT)/tao/params.h \ $(TAO_ROOT)/tao/corbafwd.h \ @@ -16608,8 +16608,8 @@ realclean: $(TAO_ROOT)/tao/Object.i \ $(TAO_ROOT)/tao/varout.i \ $(TAO_ROOT)/tao/varout.cpp \ - $(TAO_ROOT)/tao/IOPC.i \ - IOPS_T.h IOPS_T.i IOPS_T.cpp IOPS.i + $(TAO_ROOT)/tao/IOPC.i IOPS_T.h \ + IOPS_T.i IOPS_T.cpp IOPS.i .obj/PollableC.o .obj/PollableC.so .shobj/PollableC.o .shobj/PollableC.so: PollableC.cpp \ $(TAO_ROOT)/tao/PollableC.h \ $(TAO_ROOT)/tao/corbafwd.h \ @@ -18424,6 +18424,7 @@ realclean: $(TAO_ROOT)/tao/rtcorbafwd.h \ $(TAO_ROOT)/tao/rtcorbafwd.i \ $(TAO_ROOT)/tao/Priority_Mapping.i \ + $(TAO_ROOT)/tao/debug.h \ $(ACE_ROOT)/ace/Sched_Params.h \ $(ACE_ROOT)/ace/Sched_Params.i .obj/Context.o .obj/Context.so .shobj/Context.o .shobj/Context.so: Context.cpp \ diff --git a/TAO/tao/ORB.cpp b/TAO/tao/ORB.cpp index 28e7175256b..b7e7abc0230 100644 --- a/TAO/tao/ORB.cpp +++ b/TAO/tao/ORB.cpp @@ -350,27 +350,32 @@ CORBA_ORB::poll_next_response (CORBA_Environment &ACE_TRY_ENV) int CORBA_ORB::run (ACE_Time_Value *tv, - int break_on_timeouts) + int break_on_timeouts, + CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC ((CORBA::SystemException)) { - return this->orb_core_->run (tv, break_on_timeouts); + return this->orb_core_->run (tv, break_on_timeouts, ACE_TRY_ENV); } int -CORBA_ORB::run (ACE_Time_Value &tv) +CORBA_ORB::run (ACE_Time_Value &tv, CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC ((CORBA::SystemException)) { - return this->run (&tv, 1); + return this->run (&tv, 1, ACE_TRY_ENV); } int -CORBA_ORB::run (ACE_Time_Value *tv) +CORBA_ORB::run (ACE_Time_Value *tv, CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC ((CORBA::SystemException)) { - return this->run (tv, 1); + return this->run (tv, 1, ACE_TRY_ENV); } int -CORBA_ORB::run (void) +CORBA_ORB::run (CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC ((CORBA::SystemException)) { - return this->run (0, 0); + return this->run (0, 0, ACE_TRY_ENV); } CORBA_Object_ptr @@ -430,14 +435,12 @@ CORBA_ORB::resolve_name_service (ACE_Time_Value *timeout, { CORBA_Object_var return_value = CORBA_Object::_nil (); - ACE_CString name_service_ior = - this->orb_core_->orb_params ()->name_service_ior (); + // By now, the table filled in with -ORBInitRef arguments has been + // checked. We only get here if the table didn't contain an initial + // reference for the Name Service. - // Second, check to see if the user has give us a parameter on - // the command-line. - if (name_service_ior.length () == 0) - // Third, check to see if the user has an environment variable. - name_service_ior = ACE_OS::getenv ("NameServiceIOR"); + // Check to see if the user has an environment variable. + ACE_CString name_service_ior = ACE_OS::getenv ("NameServiceIOR"); if (name_service_ior.length () != 0) { @@ -465,7 +468,7 @@ CORBA_ORB::resolve_name_service (ACE_Time_Value *timeout, } return_value = - this->multicast_to_service ("NameService", + this->multicast_to_service (TAO_OBJID_NAMESERVICE, port, timeout, ACE_TRY_ENV); @@ -482,14 +485,12 @@ CORBA_ORB::resolve_trading_service (ACE_Time_Value *timeout, { CORBA_Object_var return_value = CORBA_Object::_nil (); - ACE_CString trading_service_ior = - this->orb_core_->orb_params ()->trading_service_ior (); + // By now, the table filled in with -ORBInitRef arguments has been + // checked. We only get here if the table didn't contain an initial + // reference for the Trading Service. - // Second, check to see if the user has give us a parameter on - // the command-line. - if (trading_service_ior.length () == 0) - // Third, check to see if the user has an environment variable. - trading_service_ior = ACE_OS::getenv ("TradingServiceIOR"); + // Check to see if the user has an environment variable. + ACE_CString trading_service_ior = ACE_OS::getenv ("TradingServiceIOR"); if (trading_service_ior.length () != 0) { @@ -515,7 +516,7 @@ CORBA_ORB::resolve_trading_service (ACE_Time_Value *timeout, } return_value = - this->multicast_to_service ("TradingService", + this->multicast_to_service (TAO_OBJID_TRADINGSERVICE, port, timeout, ACE_TRY_ENV); @@ -529,47 +530,45 @@ CORBA_Object_ptr CORBA_ORB::resolve_implrepo_service (ACE_Time_Value *timeout, CORBA::Environment& ACE_TRY_ENV) { - CORBA_Object_var return_value = CORBA_Object::_nil (); + CORBA_Object_var return_value = CORBA_Object::_nil (); - ACE_CString implrepo_service_ior = - this->orb_core_->orb_params ()->implrepo_service_ior (); + // By now, the table filled in with -ORBInitRef arguments has been + // checked. We only get here if the table didn't contain an initial + // reference for the Implementation Repository. - // Second, check to see if the user has give us a parameter on - // the command-line. - if (implrepo_service_ior.length () == 0) - // Third, check to see if the user has an environment variable. - implrepo_service_ior = ACE_OS::getenv ("ImplRepoServiceIOR"); + // Check to see if the user has an environment variable. + ACE_CString implrepo_service_ior = ACE_OS::getenv ("ImplRepoServiceIOR"); - if (implrepo_service_ior.length () != 0) - { - return_value = - this->string_to_object (implrepo_service_ior.c_str (), ACE_TRY_ENV); - ACE_CHECK_RETURN (CORBA_Object::_nil ()); - } - else - { - // First, determine if the port was supplied on the command line - u_short port = - this->orb_core_->orb_params ()->implrepo_service_port (); - - if (port == 0) - { - // Look for the port among our environment variables. - const char *port_number = ACE_OS::getenv ("ImplRepoServicePort"); - - if (port_number != 0) - port = (u_short) ACE_OS::atoi (port_number); - else - port = TAO_DEFAULT_IMPLREPO_SERVER_REQUEST_PORT; - } - - return_value = - this->multicast_to_service ("ImplRepoService", - port, - timeout, - ACE_TRY_ENV); - ACE_CHECK_RETURN (CORBA_Object::_nil ()); - } + if (implrepo_service_ior.length () != 0) + { + return_value = + this->string_to_object (implrepo_service_ior.c_str (), ACE_TRY_ENV); + ACE_CHECK_RETURN (CORBA_Object::_nil ()); + } + else + { + // First, determine if the port was supplied on the command line + u_short port = + this->orb_core_->orb_params ()->implrepo_service_port (); + + if (port == 0) + { + // Look for the port among our environment variables. + const char *port_number = ACE_OS::getenv ("ImplRepoServicePort"); + + if (port_number != 0) + port = (u_short) ACE_OS::atoi (port_number); + else + port = TAO_DEFAULT_IMPLREPO_SERVER_REQUEST_PORT; + } + + return_value = + this->multicast_to_service (TAO_OBJID_IMPLREPOSERVICE, + port, + timeout, + ACE_TRY_ENV); + ACE_CHECK_RETURN (CORBA_Object::_nil ()); + } return return_value._retn (); } @@ -937,14 +936,8 @@ void CORBA_ORB::check_shutdown (CORBA_Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException)) { - if (this->orb_core ()->has_shutdown ()) - { - // As defined by the CORBA 2.3 specification, throw a - // CORBA::BAD_INV_ORDER exception with minor code 4 if the ORB - // has shutdown by the time an ORB function is called. - - ACE_THROW (CORBA::BAD_INV_ORDER (4, CORBA::COMPLETED_NO)); - } + this->orb_core ()->check_shutdown (ACE_TRY_ENV); + ACE_CHECK; } #if !defined (TAO_HAS_MINIMUM_CORBA) @@ -1399,7 +1392,22 @@ CORBA::ORB_init (int &argc, // The ORB was initialized already, just return that one! if (oc != 0) - return CORBA::ORB::_duplicate (oc->orb ()); + { + if (oc->has_shutdown ()) + { + // As defined by the CORBA 2.3 specification, throw a + // CORBA::BAD_INV_ORDER exception with minor code 4 if the ORB + // has shutdown by the time an ORB function is called. + + // @@ Does the BAD_INV_ORDER exception apply here? + // -Ossama + + ACE_THROW_RETURN (CORBA::BAD_INV_ORDER (4, CORBA::COMPLETED_NO), + CORBA::ORB::_nil ()); + } + + return CORBA::ORB::_duplicate (oc->orb ()); + } // @@ As part of the ORB re-architecture this will the point where // we locate the right ORB (from a table) and use that one @@ -1716,12 +1724,12 @@ CORBA_ORB::url_ior_string_to_object (const char* str, CORBA::NO_MEMORY ()); ACE_CHECK_RETURN (CORBA::Object::_nil ()); - TAO_Stub_Auto_Ptr safe_data (data); + // TAO_Stub_Auto_Ptr safe_data (data); // Figure out if the servant is collocated. TAO_ServantBase *servant = 0; TAO_SERVANT_LOCATION servant_location = - this->_get_collocated_servant (safe_data.get (), + this->_get_collocated_servant (data, servant); int collocated = 0; @@ -1740,7 +1748,7 @@ CORBA_ORB::url_ior_string_to_object (const char* str, ACE_CHECK_RETURN (CORBA::Object::_nil ()); // All is well, so release the stub object from its auto_ptr. - data = safe_data.release (); + // data = safe_data.release (); return obj; } diff --git a/TAO/tao/ORB.h b/TAO/tao/ORB.h index 5c595a84bbf..a8ce89eef9c 100644 --- a/TAO/tao/ORB.h +++ b/TAO/tao/ORB.h @@ -512,9 +512,14 @@ public: - int run (void); - int run (ACE_Time_Value &tv); - int run (ACE_Time_Value *tv); + int run (CORBA::Environment &ACE_TRY_ENV = TAO_default_environment ()) + ACE_THROW_SPEC ((CORBA::SystemException)); + int run (ACE_Time_Value &tv, + CORBA::Environment &ACE_TRY_ENV = TAO_default_environment ()) + ACE_THROW_SPEC ((CORBA::SystemException)); + int run (ACE_Time_Value *tv, + CORBA::Environment &ACE_TRY_ENV = TAO_default_environment ()) + ACE_THROW_SPEC ((CORBA::SystemException)); // Instructs the ORB to initialize itself and run its event loop in // the current thread, not returning until the ORB has shut down. // If an error occurs during initialization or a run-time this @@ -704,7 +709,9 @@ protected: // Resolve the IOR Manipulation reference for this ORB. int run (ACE_Time_Value *tv, - int break_on_timeouts); + int break_on_timeouts, + CORBA::Environment &ACE_TRY_ENV = TAO_default_environment ()) + ACE_THROW_SPEC ((CORBA::SystemException)); // Implements the run routine private: diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp index 2594e5ab703..f1a210bfebb 100644 --- a/TAO/tao/ORB_Core.cpp +++ b/TAO/tao/ORB_Core.cpp @@ -51,10 +51,13 @@ TAO_default_environment () // **************************************************************** TAO_ORB_Core::TAO_ORB_Core (const char *orbid) - : connector_registry_ (0), + : lock_ (), + connector_registry_ (0), acceptor_registry_ (0), protocol_factories_ (0), + orb_ (CORBA::ORB::_nil()), root_poa_ (0), + root_poa_reference_ (), orb_params_ (), orbid_ (ACE_OS::strdup (orbid?orbid:"")), resource_factory_ (0), @@ -72,6 +75,11 @@ TAO_ORB_Core::TAO_ORB_Core (const char *orbid) opt_for_collocation_ (1), use_global_collocation_ (1), collocation_strategy_ (THRU_POA), +#if defined (TAO_HAS_CORBA_MESSAGING) + policy_manager_ (), + default_policies_ (), + policy_current_ (), +#endif /* TAO_HAS_CORBA_MESSAGING */ poa_current_ (0), object_adapter_ (0), tm_ (), @@ -80,15 +88,18 @@ TAO_ORB_Core::TAO_ORB_Core (const char *orbid) from_unicode_ (0), to_unicode_ (0), use_tss_resources_ (0), + tss_resources_ (), + orb_resources_ (), reactor_registry_ (0), reactor_ (0), has_shutdown_ (1), - // Start the ORB in a "shutdown" state. The only way to - // (re)start the ORB is to call CORBA::ORB_init(), which calls - // TAO_ORB_Core::init(). For that reason, only - // TAO_ORB_Core::init() should change the ORB shutdown state to - // has_shutdown_ = 0, i.e. not shutdown. + destroyed_ (1), + // Start the ORB in a "shutdown" and "destroyed" state. Only + // after CORBA::ORB_init() is called will the ORB no longer be + // shutdown. This does not mean that the ORB can be + // reinitialized. It can only be initialized once. thread_per_connection_use_timeout_ (1), + open_lock_ (), open_called_ (0), priority_mapping_ (0) { @@ -181,16 +192,9 @@ TAO_ORB_Core::init (int &argc, char *argv[]) // The following things should be changed to use the ACE_Env_Value<> // template sometime. - // Name Service IOR string. - ACE_CString ns_ior; - - // New <ObjectID>:<IOR> mapping that is used by the - // resolve_initial_references () - ACE_CString init_ref; - // Table for <ObjectID>:<IOR> mapping specified on commandline // using ORBInitRef. - TAO_IOR_LookupTable *ior_lookup_table; + TAO_IOR_LookupTable *ior_lookup_table = 0; ACE_NEW_RETURN (ior_lookup_table, TAO_IOR_LookupTable, @@ -202,15 +206,9 @@ TAO_ORB_Core::init (int &argc, char *argv[]) // Name Service port use for Multicast u_short ns_port = 0; - // Trading Service IOR string. - ACE_CString ts_ior; - // Trading Service port used for Multicast u_short ts_port = 0; - // Implementation Repository Service IOR string. - ACE_CString ir_ior; - // Implementation Repository Service port #. u_short ir_port = 0; @@ -366,11 +364,11 @@ TAO_ORB_Core::init (int &argc, char *argv[]) old_style_endpoint = 1; // Specify the name of the host (i.e., interface) on which // the server should listen. + arg_shifter.consume_arg (); // Issue a warning since this backward compatibilty support // may be dropped in future releases. - ACE_DEBUG ((LM_WARNING, "(%P|%t) \nWARNING: The `-ORBHost' option is obsolete.\n" "In the future, use the `-ORBEndpoint' option.\n")); @@ -386,9 +384,29 @@ TAO_ORB_Core::init (int &argc, char *argv[]) // Specify the IOR of the NameService. arg_shifter.consume_arg (); + + // Issue a warning since this backward compatibilty support + // may be dropped in future releases. + ACE_DEBUG ((LM_WARNING, + "(%P|%t) \nWARNING: The `-ORBNameServiceIOR' option " + "is obsolete.\n" + "Please use the `-ORBInitRef ' option instead.\n")); + if (arg_shifter.is_parameter_next ()) { - ns_ior = arg_shifter.get_current (); + // Construct an argument that would be equivalent to + // "-ORBInitRef NameService=....." + ACE_CString init_ref = + ACE_CString (TAO_OBJID_NAMESERVICE) + + ACE_CString ('=') + + ACE_CString (arg_shifter.get_current ()); + if (this->add_to_ior_table (init_ref, + *ior_lookup_table) != 0) + ACE_ERROR_RETURN ((LM_ERROR, + "TAO (%P|%t) Unable to add the Name " + "Service IOR to the lookup table.\n"), + -1); + arg_shifter.consume_arg (); } } @@ -406,12 +424,34 @@ TAO_ORB_Core::init (int &argc, char *argv[]) } else if (arg_shifter.cur_arg_strncasecmp ("-ORBTradingServiceIOR") != -1) { - // Specify the IOR of the NameService. + // Specify the IOR of the Trading Service. arg_shifter.consume_arg (); + + // Issue a warning since this backward compatibilty support + // may be dropped in future releases. + ACE_DEBUG ((LM_WARNING, + "(%P|%t) \nWARNING: The `-ORBTradingServiceIOR' " + "option is obsolete.\n" + "Please use the `-ORBInitRef' option instead.\n")); + if (arg_shifter.is_parameter_next ()) { - ts_ior = arg_shifter.get_current (); + // Construct an argument that would be equivalent to + // "-ORBInitRef TradingService=....." + + ACE_CString init_ref = + ACE_CString (TAO_OBJID_TRADINGSERVICE) + + ACE_CString ('=') + + ACE_CString (arg_shifter.get_current ()); + + if (this->add_to_ior_table (init_ref, + *ior_lookup_table) != 0) + ACE_ERROR_RETURN ((LM_ERROR, + "TAO (%P|%t) Unable to add the Trading " + "Service IOR to the lookup table.\n"), + -1); + arg_shifter.consume_arg (); } } @@ -431,9 +471,32 @@ TAO_ORB_Core::init (int &argc, char *argv[]) // Specify the IOR of the Implementation Repository arg_shifter.consume_arg (); + + // Issue a warning since this backward compatibilty support + // may be dropped in future releases. + ACE_DEBUG ((LM_WARNING, + "(%P|%t) \nWARNING: The `-ORBImplRepoServiceIOR' " + "option is obsolete.\n" + "Please use the `-ORBInitRef' option instead.\n")); + if (arg_shifter.is_parameter_next ()) { - ir_ior = arg_shifter.get_current (); + // Construct an argument that would be equivalent to + // "-ORBInitRef ImplRepoService=....." + + ACE_CString init_ref = + ACE_CString (TAO_OBJID_IMPLREPOSERVICE) + + ACE_CString ('=') + + ACE_CString (arg_shifter.get_current ()); + + if (this->add_to_ior_table (init_ref, + *ior_lookup_table) != 0) + ACE_ERROR_RETURN ((LM_ERROR, + "TAO (%P|%t) Unable to add the " + "Implmentation Repository IOR to " + "the lookup table.\n"), + -1); + arg_shifter.consume_arg (); } } @@ -700,7 +763,7 @@ TAO_ORB_Core::init (int &argc, char *argv[]) if (arg_shifter.is_parameter_next ()) { - init_ref = arg_shifter.get_current (); + ACE_CString init_ref = arg_shifter.get_current (); if (this->add_to_ior_table (init_ref, *ior_lookup_table) != 0) ACE_ERROR_RETURN ((LM_ERROR, @@ -898,20 +961,14 @@ TAO_ORB_Core::init (int &argc, char *argv[]) this->orb_params ()->endpoints (iiop_endpoint); } - // Set the init_ref. - this->orb_params ()->init_ref (init_ref); - // Set the IOR Table. this->orb_params ()->ior_lookup_table (ior_lookup_table); // Set the list of prefixes from -ORBDefaultInitRef. this->orb_params ()->default_init_ref (default_init_ref); - this->orb_params ()->name_service_ior (ns_ior); this->orb_params ()->name_service_port (ns_port); - this->orb_params ()->trading_service_ior (ts_ior); this->orb_params ()->trading_service_port (ts_port); - this->orb_params ()->implrepo_service_ior (ir_ior); this->orb_params ()->implrepo_service_port (ir_port); this->orb_params ()->use_dotted_decimal_addresses (dotted_decimal_addresses); if (rcv_sock_size != 0) @@ -951,6 +1008,7 @@ TAO_ORB_Core::init (int &argc, char *argv[]) // The ORB has been initialized, meaning that the ORB is no longer // in the shutdown state. this->has_shutdown_ = 0; + this->destroyed_ = 0; return 0; } @@ -1388,7 +1446,10 @@ TAO_ORB_Core::leader_follower (void) } int -TAO_ORB_Core::run (ACE_Time_Value *tv, int break_on_timeouts) +TAO_ORB_Core::run (ACE_Time_Value *tv, + int break_on_timeouts, + CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC ((CORBA::SystemException)) { if (TAO_debug_level >= 3) ACE_DEBUG ((LM_DEBUG, @@ -1422,20 +1483,11 @@ TAO_ORB_Core::run (ACE_Time_Value *tv, int break_on_timeouts) // This method should only be called by servers, so now we set up // for listening! - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY - { - int ret = this->open (ACE_TRY_ENV); - ACE_TRY_CHECK; + int ret = this->open (ACE_TRY_ENV); + ACE_CHECK_RETURN (-1); - if (ret == -1) - return -1; - } - ACE_CATCHANY - { - return -1; - } - ACE_ENDTRY; + if (ret == -1) + return -1; int result = 1; // 1 to detect that nothing went wrong @@ -1495,6 +1547,7 @@ TAO_ORB_Core::run (ACE_Time_Value *tv, int break_on_timeouts) void TAO_ORB_Core::shutdown (CORBA::Boolean wait_for_completion, CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC ((CORBA::SystemException)) { // Is the <wait_for_completion> semantics for this thread correct? TAO_POA::check_for_valid_wait_for_completions (wait_for_completion, @@ -1529,15 +1582,28 @@ TAO_ORB_Core::shutdown (CORBA::Boolean wait_for_completion, void TAO_ORB_Core::destroy (CORBA_Environment &ACE_TRY_ENV) + ACE_THROW_SPEC ((CORBA::SystemException)) { - // This method is currently unimplemented. - ACE_THROW (CORBA::NO_IMPLEMENT (TAO_DEFAULT_MINOR_CODE, - CORBA::COMPLETED_NO)); + if (this->has_shutdown () == 0) + { + // Shutdown the ORB and block until the shutdown is complete. + this->shutdown (1, ACE_TRY_ENV); + ACE_CHECK; + } - // Shutdown the ORB and block until the shutdown is complete. - // this->shutdown (1, ACE_TRY_ENV); + // Now remove it from the ORB table so that it's ORBid may be + // reused. + { + ACE_MT (ACE_GUARD (ACE_SYNCH_RECURSIVE_MUTEX, guard, + *ACE_Static_Object_Lock::instance ())); + TAO_ORB_Table::instance ()->unbind (this->orbid_); + } + + // The ORB has now been destroyed. + this->destroyed_ = 1; } + // Set up listening endpoints. int diff --git a/TAO/tao/ORB_Core.h b/TAO/tao/ORB_Core.h index 30128a58981..0fcae0ea7a2 100644 --- a/TAO/tao/ORB_Core.h +++ b/TAO/tao/ORB_Core.h @@ -339,21 +339,33 @@ public: TAO_Leader_Follower &leader_follower (void); // Get access to the leader_follower class. - int run (ACE_Time_Value *tv, int break_on_timeouts); + int run (ACE_Time_Value *tv, + int break_on_timeouts, + CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC ((CORBA::SystemException)); // Run the event loop void shutdown (CORBA::Boolean wait_for_completion, CORBA::Environment &ACE_TRY_ENV = - TAO_default_environment ()); + TAO_default_environment ()) + ACE_THROW_SPEC ((CORBA::SystemException)); // End the event loop int has_shutdown (void); // Get the shutdown flag value void destroy (CORBA::Environment &ACE_TRY_ENV = - TAO_default_environment ()); + TAO_default_environment ()) + ACE_THROW_SPEC ((CORBA::SystemException)); // Shutdown the ORB and free resources + int destroyed (void); + // Get the destroyed flag value + + void check_shutdown (CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC ((CORBA::SystemException)); + // Check if ORB has shutdown. If it has, throw an exception. + int thread_per_connection_timeout (ACE_Time_Value &timeout) const; // Returns the <timeout> value used by the server threads to poll // the shutdown flag. @@ -531,8 +543,10 @@ protected: // reactor_registry int has_shutdown_; - // Flag which denotes that the ORB should shut down and <run> should - // return. + // Flag which denotes that the ORB has been shutdown. + + int destroyed_; + // Flag which denotes that the ORB has been shutdown and destroyed. int thread_per_connection_use_timeout_; ACE_Time_Value thread_per_connection_timeout_; diff --git a/TAO/tao/ORB_Core.i b/TAO/tao/ORB_Core.i index 9cd06816af3..e6561913c00 100644 --- a/TAO/tao/ORB_Core.i +++ b/TAO/tao/ORB_Core.i @@ -150,6 +150,37 @@ TAO_ORB_Core::has_shutdown (void) } ACE_INLINE int +TAO_ORB_Core::destroyed (void) +{ + return this->destroyed_; +} + +ACE_INLINE void +TAO_ORB_Core::check_shutdown (CORBA_Environment &ACE_TRY_ENV) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + if (this->destroyed ()) + { + // As defined by the CORBA 2.3 specification, throw a + // CORBA::OBJECT_NOT_EXIST exception with minor code 4 if the ORB + // has shutdown by the time an ORB function is called. + + ACE_THROW (CORBA::OBJECT_NOT_EXIST (TAO_DEFAULT_MINOR_CODE, + CORBA::COMPLETED_NO)); + + } + else if (this->has_shutdown ()) + { + // As defined by the CORBA 2.3 specification, throw a + // CORBA::BAD_INV_ORDER exception with minor code 4 if the ORB + // has shutdown by the time an ORB function is called. + + ACE_THROW (CORBA::BAD_INV_ORDER (4, CORBA::COMPLETED_NO)); + } +} + + +ACE_INLINE int TAO_ORB_Core::thread_per_connection_timeout (ACE_Time_Value &timeout) const { timeout = this->thread_per_connection_timeout_; diff --git a/TAO/tao/params.cpp b/TAO/tao/params.cpp index 1ce3bd9f497..c735a1c51a4 100644 --- a/TAO/tao/params.cpp +++ b/TAO/tao/params.cpp @@ -15,11 +15,8 @@ TAO_ORB_Parameters::TAO_ORB_Parameters (void) preconnect_insertion_strategy_ (this->preconnects_list_), endpoints_list_ (), endpoint_insertion_strategy_ (this->endpoints_list_), - name_service_ior_ (), name_service_port_ (0), - trading_service_ior_ (), trading_service_port_ (0), - implrepo_service_ior_ (), implrepo_service_port_ (0), init_ref_ (), ior_lookup_table_ (0), diff --git a/TAO/tao/params.h b/TAO/tao/params.h index e4afe07d0ad..ce71d165301 100644 --- a/TAO/tao/params.h +++ b/TAO/tao/params.h @@ -119,30 +119,14 @@ public: // Specifies the endpoints on which this server is willing to // listen for requests. - const char *init_ref (void) const; - void init_ref (const ACE_CString &init_ref); - // Set/Get the Init Reference of an arbitrary ObjectID. - - const char *name_service_ior (void) const; - void name_service_ior (const ACE_CString &ns); - // Set/Get the IOR of our name service. - CORBA::UShort name_service_port (void) const; void name_service_port (CORBA::UShort port); // Set/Get the port of our name service. - const char *trading_service_ior (void) const; - void trading_service_ior (const ACE_CString &ns); - // Set/Get the IOR of our trading service. - CORBA::UShort trading_service_port (void) const; void trading_service_port (CORBA::UShort port); // Set/Get the port of our trading service. - const char *implrepo_service_ior (void) const; - void implrepo_service_ior (const ACE_CString &ir); - // Set/Get the IOR of the Implementation Repository service. - CORBA::UShort implrepo_service_port (void) const; void implrepo_service_port (CORBA::UShort port); // Set/Get the port of the Implementation Repository service. @@ -221,21 +205,12 @@ private: TAO_Endpoint_Insertion_Strategy endpoint_insertion_strategy_; // Strategy used to insert endpoints into the endpoint container. - ACE_CString name_service_ior_; - // The IOR of our configured Naming Service. - CORBA::UShort name_service_port_; // The port number of our configured Naming Service. - ACE_CString trading_service_ior_; - // The IOR of our configured Trading Service. - CORBA::UShort trading_service_port_; // The port number of our configured Trading Service. - ACE_CString implrepo_service_ior_; - // The IOR of our configured Implementation Repository. - CORBA::UShort implrepo_service_port_; // The port number of our configured Implementation Repository. diff --git a/TAO/tao/params.i b/TAO/tao/params.i index c16d322c4ab..76e1a300c92 100644 --- a/TAO/tao/params.i +++ b/TAO/tao/params.i @@ -113,30 +113,6 @@ TAO_ORB_Parameters::use_dotted_decimal_addresses (int x) } ACE_INLINE void -TAO_ORB_Parameters::init_ref (const ACE_CString &init_ref) -{ - this->init_ref_ = init_ref; -} - -ACE_INLINE const char * -TAO_ORB_Parameters::init_ref (void) const -{ - return this->init_ref_.c_str (); -} - -ACE_INLINE void -TAO_ORB_Parameters::name_service_ior (const ACE_CString &ns) -{ - this->name_service_ior_ = ns; -} - -ACE_INLINE const char * -TAO_ORB_Parameters::name_service_ior (void) const -{ - return this->name_service_ior_.c_str (); -} - -ACE_INLINE void TAO_ORB_Parameters::name_service_port (CORBA::UShort port) { this->name_service_port_ = port; @@ -149,18 +125,6 @@ TAO_ORB_Parameters::name_service_port (void) const } ACE_INLINE void -TAO_ORB_Parameters::trading_service_ior (const ACE_CString &ns) -{ - this->trading_service_ior_ = ns; -} - -ACE_INLINE const char * -TAO_ORB_Parameters::trading_service_ior (void) const -{ - return this->trading_service_ior_.c_str (); -} - -ACE_INLINE void TAO_ORB_Parameters::trading_service_port (CORBA::UShort port) { this->trading_service_port_ = port; @@ -173,18 +137,6 @@ TAO_ORB_Parameters::trading_service_port (void) const } ACE_INLINE void -TAO_ORB_Parameters::implrepo_service_ior (const ACE_CString &ir) -{ - this->implrepo_service_ior_ = ir; -} - -ACE_INLINE const char * -TAO_ORB_Parameters::implrepo_service_ior (void) const -{ - return this->implrepo_service_ior_.c_str (); -} - -ACE_INLINE void TAO_ORB_Parameters::implrepo_service_port (CORBA::UShort port) { this->implrepo_service_port_ = port; |