diff options
author | fhunleth <fhunleth@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-07-12 22:51:35 +0000 |
---|---|---|
committer | fhunleth <fhunleth@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-07-12 22:51:35 +0000 |
commit | 8d7472fbf0bf8309e0b7e0059328d9d3859fc551 (patch) | |
tree | 81942751cdc4b53719b1dc1e257a7f9ff925d2f2 | |
parent | 3944e9d8cd7e74d769aa4213e794e408fc94e332 (diff) | |
download | ATCD-8d7472fbf0bf8309e0b7e0059328d9d3859fc551.tar.gz |
ChangeLogTag:Thu Jul 12 17:30:42 2001 Frank Hunleth <fhunleth@cs.wustl.edu>
43 files changed, 810 insertions, 263 deletions
diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a index 41976a5cd06..4782e741759 100644 --- a/TAO/ChangeLogs/ChangeLog-02a +++ b/TAO/ChangeLogs/ChangeLog-02a @@ -1,3 +1,79 @@ +Thu Jul 12 17:30:42 2001 Frank Hunleth <fhunleth@cs.wustl.edu> + + * tao/orbconf.h: + * tao/ORB.cpp: + * tao/ORB_Core.cpp: + * tao/ORB_Core.h: + * tao/ORB_Core.i: + + Removed the RTORB and RTCurrent from the hardcoded list of + initial references. Now, both get added dynamically when the + RTCORBA library is loaded using the PortableInterceptors. + + This should fix a segfault that was reported by Max + Voronoy <M.Voronoy@telesenskscl.com.ua> and investigated by + Ossama. + + * tao/RTCORBA/RTCORBA.cpp: + * tao/RTCORBA/RT_ORB.cpp: + * tao/RTCORBA/RT_ORB.h: + * tao/RTCORBA/RT_ORBInitializer.cpp: + * tao/RTCORBA/RT_ORBInitializer.h: + * tao/RTCORBA/RT_ORB_Loader.cpp: + * tao/RTCORBA/RT_ORB_Loader.h: + * tao/RTCORBA/Thread_Pool.cpp: + * tao/RTCORBA/Thread_Pool.h: + + Code changes necessary to support creating the RTORB and + RTCurrent in the pre_init method rather than on demand. + This is necessary to add both objects to the initial + references list using the PortableInterceptors. + + * tests/RTCORBA/Makefile: + * tests/RTCORBA/Makefile.bor: + * tests/RTCORBA/README: + * tests/RTCORBA/ORB_init/Makefile: + * tests/RTCORBA/ORB_init/Makefile.bor: + * tests/RTCORBA/ORB_init/ORB_init.cpp: + * tests/RTCORBA/ORB_init/ORB_init.dsp: + * tests/RTCORBA/ORB_init/README: + * tests/RTCORBA/ORB_init/run_test.pl: + + Added unit test to check for correct processing when + instantiating multiple RT enabled ORBs. Looking at some + of the RT code indicated that there might be a problem, + and there actually was. Thanks to Irfan for writing + the test. + + * tao/TAO_Internal.cpp: + + Added check to automatically initialize RTCORBA if it + has been linked in. This should fix a common source + of RTCORBA errors. Thanks to Irfan for the suggestion. + + * tests/RTCORBA/Private_Connection/svc.conf: + * tests/RTCORBA/Server_Declared/server.conf: + * tests/RTCORBA/Server_Declared/svc.conf: + * tests/RTCORBA/Server_Protocol/server_iiop.conf: + * tests/RTCORBA/Server_Protocol/server_reverse.conf: + * tests/RTCORBA/Server_Protocol/server_reverse_nt.conf: + * tests/RTCORBA/Server_Protocol/server_shmiop.conf: + * tests/RTCORBA/Server_Protocol/svc.conf: + * tests/RTCORBA/Thread_Pool/svc.conf: + * tests/Exposed_Policies/server.conf: + * tests/Exposed_Policies/svc.conf: + * tests/RTCORBA/Banded_Connections/server.conf: + * tests/RTCORBA/Banded_Connections/svc.conf: + * tests/RTCORBA/Client_Propagated/svc.conf: + * tests/RTCORBA/Client_Protocol/svc.conf: + * tests/RTCORBA/Explicit_Binding/svc.conf: + * tests/RTCORBA/MT_Client_Protocol_Priority/server.conf: + * tests/RTCORBA/MT_Client_Protocol_Priority/svc.conf: + + Updated configuration files to remove RT_ORB initialization + to test out the above change. + + Thu Jul 12 15:10:52 2001 Ossama Othman <ossama@uci.edu> * TAO_IDL/driver/drv_preproc.cpp (DRV_pre_proc): diff --git a/TAO/tao/ORB.cpp b/TAO/tao/ORB.cpp index 8134ad973fa..200f90dee9d 100644 --- a/TAO/tao/ORB.cpp +++ b/TAO/tao/ORB.cpp @@ -1299,11 +1299,6 @@ CORBA_ORB::resolve_initial_references (const char *name, else if (ACE_OS::strcmp (name, TAO_OBJID_TYPECODEFACTORY) == 0) return this->orb_core ()->resolve_typecodefactory (ACE_TRY_ENV); - else if (ACE_OS::strcmp (name, TAO_OBJID_RTORB) == 0) - return this->orb_core ()->resolve_rt_orb (ACE_TRY_ENV); - - else if (ACE_OS::strcmp (name, TAO_OBJID_RTCURRENT) == 0) - return this->orb_core ()->resolve_rt_current (ACE_TRY_ENV); // ----------------------------------------------------------------- diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp index d20f36c4994..de8ebb07536 100644 --- a/TAO/tao/ORB_Core.cpp +++ b/TAO/tao/ORB_Core.cpp @@ -100,8 +100,6 @@ TAO_ORB_Core::TAO_ORB_Core (const char *orbid) dynany_factory_ (CORBA::Object::_nil ()), ior_manip_factory_ (CORBA::Object::_nil ()), ior_table_ (CORBA::Object::_nil ()), - rt_orb_ (CORBA::Object::_nil ()), - rt_current_ (CORBA::Object::_nil ()), orb_ (), root_poa_ (), orb_params_ (), @@ -1141,10 +1139,6 @@ TAO_ORB_Core::fini (void) CORBA::release (this->ior_table_); - CORBA::release (this->rt_orb_); - - CORBA::release (this->rt_current_); - if (TAO_debug_level >= 3) { ACE_DEBUG ((LM_DEBUG, @@ -2313,58 +2307,6 @@ TAO_ORB_Core::open (CORBA::Environment &ACE_TRY_ENV) } void -TAO_ORB_Core::resolve_rt_orb_i (CORBA::Environment &ACE_TRY_ENV) -{ - TAO_Object_Loader *loader = - ACE_Dynamic_Service<TAO_Object_Loader>::instance ("RT_ORB_Loader"); - - if (loader == 0) - { - // The Loader has not been statically configured, try to - // dynamically load it... - ACE_Service_Config::process_directive ( - "dynamic RT_ORB_Loader Service_Object *" - "TAO_RTCORBA:_make_TAO_RT_ORB_Loader()" - ); - - loader = - ACE_Dynamic_Service<TAO_Object_Loader>::instance ("RT_ORB_Loader"); - if (loader == 0) - ACE_THROW (CORBA::ORB::InvalidName ()); - } - - // Create RTORB object. - this->rt_orb_ = - loader->create_object (this->orb_.in (), 0, 0, ACE_TRY_ENV); -} - -void -TAO_ORB_Core::resolve_rt_current_i (CORBA::Environment &ACE_TRY_ENV) -{ - TAO_Object_Loader *loader = - ACE_Dynamic_Service<TAO_Object_Loader>::instance ("RT_Current_Loader"); - - if (loader == 0) - { - // The Loader has not been statically configured, try to - // dynamically load it... - ACE_Service_Config::process_directive ( - "dynamic RT_Current_Loader Service_Object *" - "TAO_RTCORBA:_make_TAO_RT_Current_Loader()" - ); - - loader = - ACE_Dynamic_Service<TAO_Object_Loader>::instance ("RT_Current_Loader"); - if (loader == 0) - ACE_THROW (CORBA::ORB::InvalidName ()); - } - - // Create RT_Current object. - this->rt_current_ = - loader->create_object (this->orb_.in (), 0, 0, ACE_TRY_ENV); -} - -void TAO_ORB_Core::resolve_typecodefactory_i (CORBA::Environment &ACE_TRY_ENV) { TAO_Object_Loader *loader = diff --git a/TAO/tao/ORB_Core.h b/TAO/tao/ORB_Core.h index fd6ee993d5f..fa2c5b022e0 100644 --- a/TAO/tao/ORB_Core.h +++ b/TAO/tao/ORB_Core.h @@ -928,11 +928,6 @@ protected: ACE_Allocator *buffer_allocator, ACE_Allocator *dblock_allocator, ACE_Lock *lock); - /// Obtain and cache the RT_ORB object reference - void resolve_rt_orb_i (CORBA::Environment &ACE_TRY_ENV); - - /// Obtain and cache the RT_Current flyweight reference - void resolve_rt_current_i (CORBA::Environment &ACE_TRY_ENV); /// Obtain and cache the dynamic any factory object reference. void resolve_typecodefactory_i (CORBA::Environment &ACE_TRY_ENV); @@ -1013,10 +1008,10 @@ protected: CORBA::Object_ptr ior_table_; /// The cached object reference for the RTCORBA::RTORB. - CORBA::Object_ptr rt_orb_; + CORBA::Object_var rt_orb_; /// The cached object reference for the RTCORBA::RTCurrent interface. - CORBA::Object_ptr rt_current_; + CORBA::Object_var rt_current_; /** * @note diff --git a/TAO/tao/ORB_Core.i b/TAO/tao/ORB_Core.i index 8fe1c4ad291..4cfee1e240d 100644 --- a/TAO/tao/ORB_Core.i +++ b/TAO/tao/ORB_Core.i @@ -545,27 +545,42 @@ TAO_ORB_Core::default_environment (CORBA_Environment *env) ACE_INLINE CORBA::Object_ptr TAO_ORB_Core::resolve_rt_orb (CORBA::Environment &ACE_TRY_ENV) { - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_, - CORBA::Object::_nil ()); - if (CORBA::is_nil (this->rt_orb_)) + if (CORBA::is_nil (this->rt_orb_.in ())) { - this->resolve_rt_orb_i (ACE_TRY_ENV); - ACE_CHECK_RETURN (CORBA::Object::_nil ()); + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_, + CORBA::Object::_nil ()); + if (CORBA::is_nil (this->rt_orb_.in ())) + { + // Save a reference to the priority mapping manager. + this->rt_orb_ = + this->object_ref_table ().resolve_initial_references ( + TAO_OBJID_RTORB, + ACE_TRY_ENV); + ACE_TRY_CHECK; + } } - return CORBA::Object::_duplicate (this->rt_orb_); + + return CORBA::Object::_duplicate (this->rt_orb_.in ()); } ACE_INLINE CORBA::Object_ptr TAO_ORB_Core::resolve_rt_current (CORBA::Environment &ACE_TRY_ENV) { - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_, - CORBA::Object::_nil ()); - if (CORBA::is_nil (this->rt_current_)) + if (CORBA::is_nil (this->rt_current_.in ())) { - this->resolve_rt_current_i (ACE_TRY_ENV); - ACE_CHECK_RETURN (CORBA::Object::_nil ()); + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, mon, this->lock_, + CORBA::Object::_nil ()); + if (CORBA::is_nil (this->rt_current_.in ())) + { + // Save a reference to the priority mapping manager. + this->rt_current_ = + this->object_ref_table ().resolve_initial_references ( + TAO_OBJID_RTCURRENT, + ACE_TRY_ENV); + ACE_TRY_CHECK; + } } - return CORBA::Object::_duplicate (this->rt_current_); + return CORBA::Object::_duplicate (this->rt_current_.in ()); } #if (TAO_HAS_INTERCEPTORS == 1) diff --git a/TAO/tao/RTCORBA/RTCORBA.cpp b/TAO/tao/RTCORBA/RTCORBA.cpp index f261eb42def..0a1a0bc60da 100644 --- a/TAO/tao/RTCORBA/RTCORBA.cpp +++ b/TAO/tao/RTCORBA/RTCORBA.cpp @@ -15,7 +15,6 @@ int TAO_RTCORBA_Initializer::init (void) { ACE_Service_Config::static_svcs ()->insert (&ace_svc_desc_TAO_RT_ORB_Loader); - ACE_Service_Config::static_svcs ()->insert (&ace_svc_desc_TAO_RT_Current_Loader); ACE_Service_Config::static_svcs ()->insert (&ace_svc_desc_TAO_RT_Protocols_Hooks); return 0; } diff --git a/TAO/tao/RTCORBA/RT_ORB.cpp b/TAO/tao/RTCORBA/RT_ORB.cpp index 972b7bcc96b..918570112b8 100644 --- a/TAO/tao/RTCORBA/RT_ORB.cpp +++ b/TAO/tao/RTCORBA/RT_ORB.cpp @@ -82,15 +82,15 @@ TAO_RT_CORBA_Priority_Normalizer::normalize (CORBA::Short corba_priority, return 1; } -TAO_RT_ORB::TAO_RT_ORB (CORBA::ORB_ptr orb) - : orb_ (CORBA::ORB::_duplicate (orb)), +TAO_RT_ORB::TAO_RT_ORB (TAO_ORB_Core *orb_core) + : orb_core_ (orb_core), mutex_mgr_ (), - tp_manager_ (orb) + tp_manager_ (orb_core) { TAO_RT_CORBA_Priority_Normalizer *corba_priority_normalizer = 0; ACE_NEW (corba_priority_normalizer, - TAO_RT_CORBA_Priority_Normalizer (orb->orb_core ())); - orb->orb_core ()->corba_priority_normalizer (corba_priority_normalizer); + TAO_RT_CORBA_Priority_Normalizer (this->orb_core_)); + this->orb_core_->corba_priority_normalizer (corba_priority_normalizer); } TAO_RT_ORB::~TAO_RT_ORB (void) diff --git a/TAO/tao/RTCORBA/RT_ORB.h b/TAO/tao/RTCORBA/RT_ORB.h index 2d5e45d50ac..3b248d9f12e 100644 --- a/TAO/tao/RTCORBA/RT_ORB.h +++ b/TAO/tao/RTCORBA/RT_ORB.h @@ -105,7 +105,7 @@ class TAO_RTCORBA_Export TAO_RT_ORB { public: /// Constructor. - TAO_RT_ORB (CORBA::ORB_ptr orb); + TAO_RT_ORB (TAO_ORB_Core *orb_core); /** * Create a new mutex. Mutexes returned by this method @@ -261,7 +261,7 @@ protected: virtual ~TAO_RT_ORB (void); /// Reference to our creating ORB. - CORBA::ORB_var orb_; + TAO_ORB_Core *orb_core_; /// mutex_mgr_ manages the names associated with named mutexes. TAO_Named_RT_Mutex_Manager mutex_mgr_; diff --git a/TAO/tao/RTCORBA/RT_ORBInitializer.cpp b/TAO/tao/RTCORBA/RT_ORBInitializer.cpp index 674e27f0d04..81ecf82234d 100644 --- a/TAO/tao/RTCORBA/RT_ORBInitializer.cpp +++ b/TAO/tao/RTCORBA/RT_ORBInitializer.cpp @@ -12,9 +12,14 @@ ACE_RCSID (TAO, RT_ORBInitializer, "$Id$") #include "Priority_Mapping_Manager.h" #include "tao/Exception.h" #include "tao/ORB_Core.h" +#include "tao/ORBInitInfo.h" #include "RT_ORB_Loader.h" #include "RT_Stub_Factory.h" #include "RT_Endpoint_Selector_Factory.h" +#include "Linear_Priority_Mapping.h" +#include "Direct_Priority_Mapping.h" +#include "RT_ORB.h" +#include "RT_Current.h" #include "ace/Service_Repository.h" #include "ace/Svc_Conf.h" @@ -22,8 +27,10 @@ ACE_RCSID (TAO, RT_ORBInitializer, "$Id$") static const char *rt_poa_factory_name = "TAO_RT_POA"; static const char *rt_poa_factory_directive = "dynamic TAO_RT_POA Service_Object * TAO_RTPortableServer:_make_TAO_RT_Object_Adapter_Factory()"; -TAO_RT_ORBInitializer::TAO_RT_ORBInitializer (TAO_Priority_Mapping *priority_mapping) - : priority_mapping_ (priority_mapping) +TAO_RT_ORBInitializer::TAO_RT_ORBInitializer (int priority_mapping_type, + int sched_policy) + : priority_mapping_type_ (priority_mapping_type), + sched_policy_ (sched_policy) { } @@ -56,11 +63,35 @@ TAO_RT_ORBInitializer::pre_init ( // Set the name of the stub factory to be the RT_Stub_Factory. TAO_ORB_Core::set_endpoint_selector_factory ("RT_Endpoint_Selector_Factory"); + // Sets the client_protocol policy. + TAO_RT_Protocols_Hooks::set_client_protocols_hook + (TAO_ClientProtocolPolicy::hook); + + // Sets the server_protocol policy. + TAO_RT_Protocols_Hooks::set_server_protocols_hook + (TAO_ServerProtocolPolicy::hook); + + + // Create the initial priority mapping instance. + TAO_Priority_Mapping *pm; + switch (this->priority_mapping_type_) + { + case TAO_PRIORITY_MAPPING_LINEAR: + ACE_NEW (pm, + TAO_Linear_Priority_Mapping (this->sched_policy_)); + break; + default: + case TAO_PRIORITY_MAPPING_DIRECT: + ACE_NEW (pm, + TAO_Direct_Priority_Mapping (this->sched_policy_)); + break; + } + // Set the Priority_Mapping_Manager TAO_Priority_Mapping_Manager *manager = 0; ACE_NEW_THROW_EX (manager, - TAO_Priority_Mapping_Manager (this->priority_mapping_), + TAO_Priority_Mapping_Manager (pm), CORBA::NO_MEMORY ( CORBA::SystemException::_tao_minor_code ( TAO_DEFAULT_MINOR_CODE, @@ -75,13 +106,59 @@ TAO_RT_ORBInitializer::pre_init ( ACE_TRY_ENV); ACE_CHECK; - // Sets the client_protocol policy. - TAO_RT_Protocols_Hooks::set_client_protocols_hook - (TAO_ClientProtocolPolicy::hook); + // @@ This is busted. TAO_ORBInitInfo should do proper reference + // counting. + // Narrow to a TAO_ORBInitInfo object to get access to the + // orb_core() TAO extension. + TAO_ORBInitInfo_var tao_info = TAO_ORBInitInfo::_narrow (info, + ACE_TRY_ENV); + ACE_CHECK; - // Sets the server_protocol policy. - TAO_RT_Protocols_Hooks::set_server_protocols_hook - (TAO_ServerProtocolPolicy::hook); + if (CORBA::is_nil (tao_info.in ())) + { + if (TAO_debug_level > 0) + ACE_ERROR ((LM_ERROR, + "(%P|%t) Security_ORBInitializer::pre_init:\n" + "(%P|%t) Unable to narrow " + "\"PortableInterceptor::ORBInitInfo_ptr\" to\n" + "(%P|%t) \"TAO_ORBInitInfo *.\"\n")); + + ACE_THROW (CORBA::INTERNAL ()); + } + + // Create the RT_ORB. + CORBA::Object_ptr rt_orb = CORBA::Object::_nil (); + ACE_NEW_THROW_EX (rt_orb, + TAO_RT_ORB (tao_info->orb_core ()), + CORBA::NO_MEMORY ( + CORBA::SystemException::_tao_minor_code ( + TAO_DEFAULT_MINOR_CODE, + ENOMEM), + CORBA::COMPLETED_NO)); + ACE_CHECK; + CORBA::Object_var safe_rt_orb = rt_orb; + + info->register_initial_reference (TAO_OBJID_RTORB, + rt_orb, + ACE_TRY_ENV); + ACE_CHECK; + + // Create the RT_Current. + CORBA::Object_ptr current; + ACE_NEW_THROW_EX (current, + TAO_RT_Current (tao_info->orb_core ()), + CORBA::NO_MEMORY ( + CORBA::SystemException::_tao_minor_code ( + TAO_DEFAULT_MINOR_CODE, + ENOMEM), + CORBA::COMPLETED_NO)); + ACE_CHECK; + CORBA::Object_var safe_rt_current = current; + + info->register_initial_reference (TAO_OBJID_RTCURRENT, + current, + ACE_TRY_ENV); + ACE_CHECK; } void @@ -94,6 +171,7 @@ TAO_RT_ORBInitializer::post_init ( this->register_policy_factories (info, ACE_TRY_ENV); + ACE_CHECK; } diff --git a/TAO/tao/RTCORBA/RT_ORBInitializer.h b/TAO/tao/RTCORBA/RT_ORBInitializer.h index 6e9441a7832..88ec7c6fdf1 100644 --- a/TAO/tao/RTCORBA/RT_ORBInitializer.h +++ b/TAO/tao/RTCORBA/RT_ORBInitializer.h @@ -36,16 +36,21 @@ #pragma warning(disable:4250) #endif /* _MSC_VER */ -// Forward references. -class TAO_Priority_Mapping; - /// RTCORBA ORB initializer. class TAO_RTCORBA_Export TAO_RT_ORBInitializer : public virtual PortableInterceptor::ORBInitializer, public virtual TAO_Local_RefCounted_Object { public: - TAO_RT_ORBInitializer (TAO_Priority_Mapping *priority_mapping); + // Priority mapping types + enum + { + TAO_PRIORITY_MAPPING_LINEAR, + TAO_PRIORITY_MAPPING_DIRECT + }; + + TAO_RT_ORBInitializer (int priority_mapping_type, + int sched_policy); virtual void pre_init (PortableInterceptor::ORBInitInfo_ptr info TAO_ENV_ARG_DECL_WITH_DEFAULTS) @@ -69,8 +74,11 @@ private: /// a single instance between all ORBs. TAO_RT_PolicyFactory policy_factory_; - /// Initial priority mapping. - TAO_Priority_Mapping *priority_mapping_; + /// Initial priority mapping type. + int priority_mapping_type_; + + /// Initial scheduling policy. + int sched_policy_; }; #if defined(_MSC_VER) && (_MSC_VER >= 1200) diff --git a/TAO/tao/RTCORBA/RT_ORB_Loader.cpp b/TAO/tao/RTCORBA/RT_ORB_Loader.cpp index 82ec69e76e4..087919e5c70 100644 --- a/TAO/tao/RTCORBA/RT_ORB_Loader.cpp +++ b/TAO/tao/RTCORBA/RT_ORB_Loader.cpp @@ -1,11 +1,7 @@ // $Id$ #include "RT_ORB_Loader.h" -#include "RT_ORB.h" -#include "RT_Current.h" #include "RT_ORBInitializer.h" -#include "Linear_Priority_Mapping.h" -#include "Direct_Priority_Mapping.h" #include "tao/debug.h" #include "tao/ORB_Core.h" @@ -23,7 +19,6 @@ TAO_RT_ORB_Loader::Initializer (void) } TAO_RT_ORB_Loader::TAO_RT_ORB_Loader (void) - : initialized_ (0) { } @@ -31,13 +26,32 @@ TAO_RT_ORB_Loader::~TAO_RT_ORB_Loader (void) { } +CORBA::Object_ptr +TAO_RT_ORB_Loader::create_object (CORBA::ORB_ptr, + int, + char *[], + CORBA::Environment &) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + return CORBA::Object::_nil (); +} + int TAO_RT_ORB_Loader::init (int argc, char* argv[]) { ACE_TRACE ("TAO_RT_ORB_Loader::init"); - int priority_mapping_type = TAO_PRIORITY_MAPPING_DIRECT; + static int initialized = 0; + + // Only allow initialization once. + if (initialized) + return 0; + + initialized = 1; + + // Set defaults. + int priority_mapping_type = TAO_RT_ORBInitializer::TAO_PRIORITY_MAPPING_DIRECT; int sched_policy = ACE_SCHED_OTHER; int curarg = 0; @@ -53,10 +67,10 @@ TAO_RT_ORB_Loader::init (int argc, if (ACE_OS::strcasecmp (name, "linear") == 0) - priority_mapping_type = TAO_PRIORITY_MAPPING_LINEAR; + priority_mapping_type = TAO_RT_ORBInitializer::TAO_PRIORITY_MAPPING_LINEAR; else if (ACE_OS::strcasecmp (name, "direct") == 0) - priority_mapping_type = TAO_PRIORITY_MAPPING_DIRECT; + priority_mapping_type = TAO_RT_ORBInitializer::TAO_PRIORITY_MAPPING_DIRECT; else ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("RT_ORB_Loader - unknown argument") @@ -97,24 +111,6 @@ TAO_RT_ORB_Loader::init (int argc, } } - // Create the initial priority mapping instance. - TAO_Priority_Mapping *pm; - switch (priority_mapping_type) - { - case TAO_PRIORITY_MAPPING_LINEAR: - ACE_NEW_RETURN (pm, - TAO_Linear_Priority_Mapping (sched_policy), - 0); - break; - default: - case TAO_PRIORITY_MAPPING_DIRECT: - ACE_NEW_RETURN (pm, - TAO_Direct_Priority_Mapping (sched_policy), - 0); - break; - } - - // Register the ORB initializer. ACE_TRY_NEW_ENV { @@ -124,7 +120,8 @@ TAO_RT_ORB_Loader::init (int argc, /// Register the RTCORBA ORBInitializer. ACE_NEW_THROW_EX (temp_orb_initializer, - TAO_RT_ORBInitializer (pm), + TAO_RT_ORBInitializer (priority_mapping_type, + sched_policy), CORBA::NO_MEMORY ( CORBA_SystemException::_tao_minor_code ( TAO_DEFAULT_MINOR_CODE, @@ -145,66 +142,12 @@ TAO_RT_ORB_Loader::init (int argc, } ACE_ENDTRY; - // Allow someone to retrieve RTORB. - this->initialized_ = 1; - - // Allow someone to retrieve RTCurrent now. - ACE_Service_Config::static_svcs ()-> - insert (&ace_svc_desc_TAO_RT_Current_Loader); - return 0; } -CORBA::Object_ptr -TAO_RT_ORB_Loader::create_object (CORBA::ORB_ptr orb, - int, - char *[], - CORBA::Environment &ACE_TRY_ENV) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - // Return RT_ORB - CORBA::Object_ptr rt_orb = CORBA::Object::_nil (); - - // Check that all of the RTCORBA hooks have been initialized - // successfully. - if (this->initialized_) - { - ACE_NEW_THROW_EX (rt_orb, - TAO_RT_ORB (orb), - CORBA::NO_MEMORY ( - CORBA::SystemException::_tao_minor_code ( - TAO_DEFAULT_MINOR_CODE, - ENOMEM), - CORBA::COMPLETED_NO)); - ACE_CHECK_RETURN (CORBA::Object::_nil ()); - } - - return rt_orb; -} ///////////////////////////////////////////////////////////////////// -CORBA::Object_ptr -TAO_RT_Current_Loader::create_object (CORBA::ORB_ptr orb, - int, - char *[], - CORBA::Environment &ACE_TRY_ENV) - ACE_THROW_SPEC ((CORBA::SystemException)) -{ - /// Return RT_Current - CORBA::Object_ptr current; - - ACE_NEW_THROW_EX (current, - TAO_RT_Current (orb->orb_core ()), - CORBA::NO_MEMORY ( - CORBA::SystemException::_tao_minor_code ( - TAO_DEFAULT_MINOR_CODE, - ENOMEM), - CORBA::COMPLETED_NO)); - ACE_CHECK_RETURN (CORBA::Object::_nil ()); - - return current; -} ACE_FACTORY_DEFINE (TAO, TAO_RT_ORB_Loader) ACE_STATIC_SVC_DEFINE (TAO_RT_ORB_Loader, @@ -215,11 +158,3 @@ ACE_STATIC_SVC_DEFINE (TAO_RT_ORB_Loader, | ACE_Service_Type::DELETE_OBJ, 0) -ACE_FACTORY_DEFINE (TAO, TAO_RT_Current_Loader) -ACE_STATIC_SVC_DEFINE (TAO_RT_Current_Loader, - ACE_TEXT ("RT_Current_Loader"), - ACE_SVC_OBJ_T, - &ACE_SVC_NAME (TAO_RT_Current_Loader), - ACE_Service_Type::DELETE_THIS - | ACE_Service_Type::DELETE_OBJ, - 0) diff --git a/TAO/tao/RTCORBA/RT_ORB_Loader.h b/TAO/tao/RTCORBA/RT_ORB_Loader.h index 118f1431da9..6312177b727 100644 --- a/TAO/tao/RTCORBA/RT_ORB_Loader.h +++ b/TAO/tao/RTCORBA/RT_ORB_Loader.h @@ -31,13 +31,6 @@ class TAO_ORB_Core; class TAO_RTCORBA_Export TAO_RT_ORB_Loader : public TAO_Object_Loader { public: - // = Priority mapping types - enum - { - TAO_PRIORITY_MAPPING_LINEAR, - TAO_PRIORITY_MAPPING_DIRECT - }; - /// Constructor. TAO_RT_ORB_Loader (void); @@ -48,43 +41,22 @@ public: virtual int init (int argc, char* []); - /// Creates a RT_ORB and returns it. + /// Create the object (unused) virtual CORBA::Object_ptr create_object (CORBA::ORB_ptr orb, - int argc, - char *argv [], - CORBA::Environment &) - ACE_THROW_SPEC ((CORBA::SystemException)); + int argc, + char *argv [], + CORBA::Environment &) + ACE_THROW_SPEC ((CORBA::SystemException)); /// Used to force the initialization of the ORB code. static int Initializer (void); -private: - - /// Flag to indicate whether the RT_ORB_Loader has been initialized. - /// If it hasn't, it should give back an RTORB since not all of the - /// RTCORBA hooks are in place. - int initialized_; }; ACE_STATIC_SVC_DECLARE_EXPORT (TAO_RTCORBA, TAO_RT_ORB_Loader) ACE_FACTORY_DECLARE (TAO_RTCORBA, TAO_RT_ORB_Loader) -class TAO_RTCORBA_Export TAO_RT_Current_Loader : public TAO_Object_Loader -{ -public: - /// Creates an RT_Current flyweight object and returns it. - virtual CORBA::Object_ptr create_object (CORBA::ORB_ptr orb, - int argc, - char *argv [], - CORBA::Environment &) - ACE_THROW_SPEC ((CORBA::SystemException)); -}; - - -ACE_STATIC_SVC_DECLARE_EXPORT (TAO_RTCORBA, TAO_RT_Current_Loader) -ACE_FACTORY_DECLARE (TAO_RTCORBA, TAO_RT_Current_Loader) - // #if defined(ACE_HAS_BROKEN_STATIC_CONSTRUCTORS) // typedef int (*TAO_Module_Initializer) (void); diff --git a/TAO/tao/RTCORBA/Thread_Pool.cpp b/TAO/tao/RTCORBA/Thread_Pool.cpp index 869b724ba57..be3f4bf7f60 100644 --- a/TAO/tao/RTCORBA/Thread_Pool.cpp +++ b/TAO/tao/RTCORBA/Thread_Pool.cpp @@ -303,8 +303,8 @@ TAO_Thread_Pool::orb (void) const 0), \ CORBA::COMPLETED_NO)); -TAO_Thread_Pool_Manager::TAO_Thread_Pool_Manager (CORBA::ORB_ptr orb) - : orb_ (CORBA::ORB::_duplicate (orb)), +TAO_Thread_Pool_Manager::TAO_Thread_Pool_Manager (TAO_ORB_Core *orb_core) + : orb_core_ (orb_core), thread_pools_ (), thread_pool_id_counter_ (0), lock_ () @@ -401,7 +401,7 @@ TAO_Thread_Pool_Manager::create_threadpool_i (CORBA::ULong stacksize, allow_request_buffering, max_buffered_requests, max_request_buffer_size, - this->orb_.in ()), + this->orb_core_->orb ()), CORBA::NO_MEMORY ()); ACE_CHECK_RETURN (0); @@ -430,7 +430,7 @@ TAO_Thread_Pool_Manager::create_threadpool_with_lanes_i (CORBA::ULong stacksize, allow_request_buffering, max_buffered_requests, max_request_buffer_size, - this->orb_.in ()), + this->orb_core_->orb ()), CORBA::NO_MEMORY ()); ACE_CHECK_RETURN (0); diff --git a/TAO/tao/RTCORBA/Thread_Pool.h b/TAO/tao/RTCORBA/Thread_Pool.h index 6f337458ea9..bce170bd27e 100644 --- a/TAO/tao/RTCORBA/Thread_Pool.h +++ b/TAO/tao/RTCORBA/Thread_Pool.h @@ -199,7 +199,7 @@ class TAO_RTCORBA_Export TAO_Thread_Pool_Manager public: /// Constructor. - TAO_Thread_Pool_Manager (CORBA::ORB_ptr orb); + TAO_Thread_Pool_Manager (TAO_ORB_Core *orb_core); /// Destructor. ~TAO_Thread_Pool_Manager (void); @@ -282,7 +282,7 @@ private: // @} - CORBA::ORB_var orb_; + TAO_ORB_Core *orb_core_; THREAD_POOLS thread_pools_; RTCORBA::ThreadpoolId thread_pool_id_counter_; diff --git a/TAO/tao/TAO_Internal.cpp b/TAO/tao/TAO_Internal.cpp index 8cb59507ef7..95af7b321e0 100644 --- a/TAO/tao/TAO_Internal.cpp +++ b/TAO/tao/TAO_Internal.cpp @@ -19,6 +19,7 @@ #include "StringSeqC.h" #include "Object_Loader.h" +#include "ace/Dynamic_Service.h" #include "Default_Stub_Factory.h" #include "Default_Endpoint_Selector_Factory.h" @@ -222,10 +223,20 @@ TAO_Internal::open_services_i (int &argc, int result = 0; if (skip_service_config_open == 0) - result = ACE_Service_Config::open (argc, argv, - ACE_DEFAULT_LOGGER_KEY, - 0, // Don't ignore static services. - ignore_default_svc_conf_file); + { + result = ACE_Service_Config::open (argc, argv, + ACE_DEFAULT_LOGGER_KEY, + 0, // Don't ignore static services. + ignore_default_svc_conf_file); + } + + // Handle RTCORBA library special case. Since RTCORBA needs + // its init method call to register several hooks, call it here + // if it hasn't already been called. + TAO_Object_Loader *rt_loader = + ACE_Dynamic_Service<TAO_Object_Loader>::instance ("RT_ORB_Loader"); + if (rt_loader != 0) + rt_loader->init (0, 0); // @@ What the heck do these things do and do we need to avoid // calling them if we're not invoking the svc.conf file? diff --git a/TAO/tao/orbconf.h b/TAO/tao/orbconf.h index 9261770e8e8..63f2fb2c17e 100644 --- a/TAO/tao/orbconf.h +++ b/TAO/tao/orbconf.h @@ -395,9 +395,7 @@ TAO_OBJID_IORMANIPULATION, \ TAO_OBJID_IORTABLE, \ TAO_OBJID_DYNANYFACTORY, \ - TAO_OBJID_TYPECODEFACTORY, \ - TAO_OBJID_RTORB, \ - TAO_OBJID_RTCURRENT + TAO_OBJID_TYPECODEFACTORY // @@ Some initial references are added via other means, such as // ORBInitInfo::register_initial_references(). Those should not be // placed in the above list. Ideally, we should no longer need the diff --git a/TAO/tests/Exposed_Policies/server.conf b/TAO/tests/Exposed_Policies/server.conf index 9f9ae96d624..7933e5a54a2 100644 --- a/TAO/tests/Exposed_Policies/server.conf +++ b/TAO/tests/Exposed_Policies/server.conf @@ -1,2 +1 @@ -static RT_ORB_Loader "" static Advanced_Resource_Factory "-ORBReactorType tp -ORBReactorRegistry per-priority" diff --git a/TAO/tests/Exposed_Policies/svc.conf b/TAO/tests/Exposed_Policies/svc.conf index 28ac706710e..7933e5a54a2 100644 --- a/TAO/tests/Exposed_Policies/svc.conf +++ b/TAO/tests/Exposed_Policies/svc.conf @@ -1,3 +1 @@ -static RT_ORB_Loader "" static Advanced_Resource_Factory "-ORBReactorType tp -ORBReactorRegistry per-priority" - diff --git a/TAO/tests/RTCORBA/Banded_Connections/server.conf b/TAO/tests/RTCORBA/Banded_Connections/server.conf index 92ef27a0b3e..8100e1d8dd3 100644 --- a/TAO/tests/RTCORBA/Banded_Connections/server.conf +++ b/TAO/tests/RTCORBA/Banded_Connections/server.conf @@ -1,5 +1,4 @@ # $Id$ # static Advanced_Resource_Factory "-ORBReactorType tp -ORBReactorRegistry per-priority" -static RT_ORB_Loader "" diff --git a/TAO/tests/RTCORBA/Banded_Connections/svc.conf b/TAO/tests/RTCORBA/Banded_Connections/svc.conf deleted file mode 100644 index d264034e12c..00000000000 --- a/TAO/tests/RTCORBA/Banded_Connections/svc.conf +++ /dev/null @@ -1 +0,0 @@ -static RT_ORB_Loader ""
\ No newline at end of file diff --git a/TAO/tests/RTCORBA/Client_Propagated/svc.conf b/TAO/tests/RTCORBA/Client_Propagated/svc.conf deleted file mode 100644 index d264034e12c..00000000000 --- a/TAO/tests/RTCORBA/Client_Propagated/svc.conf +++ /dev/null @@ -1 +0,0 @@ -static RT_ORB_Loader ""
\ No newline at end of file diff --git a/TAO/tests/RTCORBA/Client_Protocol/svc.conf b/TAO/tests/RTCORBA/Client_Protocol/svc.conf index d6df467d3ea..3dec1aece65 100644 --- a/TAO/tests/RTCORBA/Client_Protocol/svc.conf +++ b/TAO/tests/RTCORBA/Client_Protocol/svc.conf @@ -2,4 +2,3 @@ # $Id$ # static SHMIOP_Factory "-MMAPFilePrefix server_shmiop" -static RT_ORB_Loader "" diff --git a/TAO/tests/RTCORBA/Explicit_Binding/svc.conf b/TAO/tests/RTCORBA/Explicit_Binding/svc.conf index d6df467d3ea..3dec1aece65 100644 --- a/TAO/tests/RTCORBA/Explicit_Binding/svc.conf +++ b/TAO/tests/RTCORBA/Explicit_Binding/svc.conf @@ -2,4 +2,3 @@ # $Id$ # static SHMIOP_Factory "-MMAPFilePrefix server_shmiop" -static RT_ORB_Loader "" diff --git a/TAO/tests/RTCORBA/MT_Client_Protocol_Priority/server.conf b/TAO/tests/RTCORBA/MT_Client_Protocol_Priority/server.conf index 60522fde328..65d4ff291ef 100644 --- a/TAO/tests/RTCORBA/MT_Client_Protocol_Priority/server.conf +++ b/TAO/tests/RTCORBA/MT_Client_Protocol_Priority/server.conf @@ -2,4 +2,3 @@ # dynamic SHMIOP_Factory Service_Object *TAO_Strategies:_make_TAO_SHMIOP_Protocol_Factory () "-MMAPFilePrefix server_shmiop " static Advanced_Resource_Factory "-ORBReactorType tp -ORBReactorRegistry per-priority" -static RT_ORB_Loader "" diff --git a/TAO/tests/RTCORBA/MT_Client_Protocol_Priority/svc.conf b/TAO/tests/RTCORBA/MT_Client_Protocol_Priority/svc.conf deleted file mode 100644 index 4a910bbc3f7..00000000000 --- a/TAO/tests/RTCORBA/MT_Client_Protocol_Priority/svc.conf +++ /dev/null @@ -1 +0,0 @@ -static RT_ORB_Loader "" diff --git a/TAO/tests/RTCORBA/Makefile b/TAO/tests/RTCORBA/Makefile index f6c57c4b846..b1f5213260c 100644 --- a/TAO/tests/RTCORBA/Makefile +++ b/TAO/tests/RTCORBA/Makefile @@ -19,7 +19,8 @@ DIRS = Banded_Connections \ Private_Connection \ Thread_Pool \ MT_Client_Protocol_Priority \ - RTMutex + RTMutex \ + ORB_init ifndef TAO_ROOT TAO_ROOT = $(ACE_ROOT)/TAO diff --git a/TAO/tests/RTCORBA/Makefile.bor b/TAO/tests/RTCORBA/Makefile.bor index 1866e0033cf..c45189afe65 100644 --- a/TAO/tests/RTCORBA/Makefile.bor +++ b/TAO/tests/RTCORBA/Makefile.bor @@ -12,6 +12,7 @@ DIRS = \ Private_Connection \ Thread_Pool \ MT_Client_Protocol_Priority \ - RTMutex + RTMutex \ + ORB_init !include <$(ACE_ROOT)\include\makeinclude\recurse.bor> diff --git a/TAO/tests/RTCORBA/ORB_init/Makefile b/TAO/tests/RTCORBA/ORB_init/Makefile new file mode 100644 index 00000000000..8609193f68f --- /dev/null +++ b/TAO/tests/RTCORBA/ORB_init/Makefile @@ -0,0 +1,247 @@ +#---------------------------------------------------------------------------- +# +# $Id$ +# +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- +# Local macros +#---------------------------------------------------------------------------- + +ifndef TAO_ROOT + TAO_ROOT = $(ACE_ROOT)/TAO +endif # ! TAO_ROOT + +BIN_UNCHECKED = ORB_init + +SRC = $(addsuffix .cpp, $(BIN)) + +ORB_INIT_OBJS = $(SRC:.cpp=.o) + +BUILD = $(BIN) +VBIN = $(BIN:%=%$(VAR)) + +#---------------------------------------------------------------------------- +# Include macros and targets +#---------------------------------------------------------------------------- + +include $(ACE_ROOT)/include/makeinclude/wrapper_macros.GNU +include $(ACE_ROOT)/include/makeinclude/macros.GNU +include $(TAO_ROOT)/rules.tao.GNU + +ifeq ($(rt_corba),1) +BIN=$(BIN_UNCHECKED) +endif # rt_corba + +include $(ACE_ROOT)/include/makeinclude/rules.common.GNU +include $(ACE_ROOT)/include/makeinclude/rules.nonested.GNU +include $(ACE_ROOT)/include/makeinclude/rules.local.GNU +include $(TAO_ROOT)/taoconfig.mk + +#---------------------------------------------------------------------------- +# Local targets +#---------------------------------------------------------------------------- + +.PRECIOUS: $(foreach ext, $(IDL_EXT), test$(ext)) + +ORB_init: $(addprefix $(VDIR),$(ORB_INIT_OBJS)) + $(LINK.cc) $(LDFLAGS) -o $@ $^ $(RT_TAO_CLNT_LIBS) $(POSTLINK) + +# DO NOT DELETE THIS LINE -- g++dep uses it. +# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. + + +.obj/ORB_init.o .obj/ORB_init.so .shobj/ORB_init.o .shobj/ORB_init.so: ORB_init.cpp \ + $(TAO_ROOT)/tao/corba.h \ + $(ACE_ROOT)/ace/pre.h \ + $(ACE_ROOT)/ace/post.h \ + $(ACE_ROOT)/ace/ACE_export.h \ + $(ACE_ROOT)/ace/svc_export.h \ + $(ACE_ROOT)/ace/ace_wchar.h \ + $(ACE_ROOT)/ace/ace_wchar.inl \ + $(ACE_ROOT)/ace/OS_Errno.h \ + $(ACE_ROOT)/ace/OS_Export.h \ + $(ACE_ROOT)/ace/OS_Errno.inl \ + $(TAO_ROOT)/tao/corbafwd.h \ + $(ACE_ROOT)/ace/CDR_Base.h \ + $(ACE_ROOT)/ace/Basic_Types.h \ + $(ACE_ROOT)/ace/Basic_Types.i \ + $(ACE_ROOT)/ace/Message_Block.h \ + $(ACE_ROOT)/ace/ACE.h \ + $(ACE_ROOT)/ace/OS.h \ + $(ACE_ROOT)/ace/OS_Dirent.h \ + $(ACE_ROOT)/ace/OS_Dirent.inl \ + $(ACE_ROOT)/ace/OS_String.h \ + $(ACE_ROOT)/ace/OS_String.inl \ + $(ACE_ROOT)/ace/OS_Memory.h \ + $(ACE_ROOT)/ace/OS_Memory.inl \ + $(ACE_ROOT)/ace/OS_TLI.h \ + $(ACE_ROOT)/ace/OS_TLI.inl \ + $(ACE_ROOT)/ace/Min_Max.h \ + $(ACE_ROOT)/ace/streams.h \ + $(ACE_ROOT)/ace/Trace.h \ + $(ACE_ROOT)/ace/OS.i \ + $(ACE_ROOT)/ace/Flag_Manip.h \ + $(ACE_ROOT)/ace/Flag_Manip.i \ + $(ACE_ROOT)/ace/Handle_Ops.h \ + $(ACE_ROOT)/ace/Handle_Ops.i \ + $(ACE_ROOT)/ace/Lib_Find.h \ + $(ACE_ROOT)/ace/Lib_Find.i \ + $(ACE_ROOT)/ace/Init_ACE.h \ + $(ACE_ROOT)/ace/Init_ACE.i \ + $(ACE_ROOT)/ace/Sock_Connect.h \ + $(ACE_ROOT)/ace/Sock_Connect.i \ + $(ACE_ROOT)/ace/ACE.i \ + $(ACE_ROOT)/ace/Malloc.h \ + $(ACE_ROOT)/ace/Log_Msg.h \ + $(ACE_ROOT)/ace/Log_Record.h \ + $(ACE_ROOT)/ace/Log_Priority.h \ + $(ACE_ROOT)/ace/Log_Record.i \ + $(ACE_ROOT)/ace/OS_Log_Msg_Attributes.h \ + $(ACE_ROOT)/ace/OS_Log_Msg_Attributes.inl \ + $(ACE_ROOT)/ace/Malloc.i \ + $(ACE_ROOT)/ace/Malloc_T.h \ + $(ACE_ROOT)/ace/Synch.h \ + $(ACE_ROOT)/ace/Synch.i \ + $(ACE_ROOT)/ace/Synch_T.h \ + $(ACE_ROOT)/ace/Synch_T.i \ + $(ACE_ROOT)/ace/Thread.h \ + $(ACE_ROOT)/ace/Thread_Adapter.h \ + $(ACE_ROOT)/ace/Base_Thread_Adapter.h \ + $(ACE_ROOT)/ace/Base_Thread_Adapter.inl \ + $(ACE_ROOT)/ace/Thread_Adapter.inl \ + $(ACE_ROOT)/ace/Thread.i \ + $(ACE_ROOT)/ace/Atomic_Op.i \ + $(ACE_ROOT)/ace/Synch_T.cpp \ + $(ACE_ROOT)/ace/Malloc_Allocator.h \ + $(ACE_ROOT)/ace/Malloc_Base.h \ + $(ACE_ROOT)/ace/Malloc_Allocator.i \ + $(ACE_ROOT)/ace/Free_List.h \ + $(ACE_ROOT)/ace/Free_List.i \ + $(ACE_ROOT)/ace/Free_List.cpp \ + $(ACE_ROOT)/ace/Malloc_T.i \ + $(ACE_ROOT)/ace/Malloc_T.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.h \ + $(ACE_ROOT)/ace/Event_Handler.h \ + $(ACE_ROOT)/ace/Event_Handler.i \ + $(ACE_ROOT)/ace/Signal.h \ + $(ACE_ROOT)/ace/Signal.i \ + $(ACE_ROOT)/ace/Mem_Map.h \ + $(ACE_ROOT)/ace/Mem_Map.i \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.h \ + $(ACE_ROOT)/ace/SV_Semaphore_Simple.i \ + $(ACE_ROOT)/ace/SV_Semaphore_Complex.i \ + $(ACE_ROOT)/ace/Unbounded_Set.h \ + $(ACE_ROOT)/ace/Node.h \ + $(ACE_ROOT)/ace/Node.cpp \ + $(ACE_ROOT)/ace/Unbounded_Set.inl \ + $(ACE_ROOT)/ace/Unbounded_Set.cpp \ + $(ACE_ROOT)/ace/Memory_Pool.i \ + $(ACE_ROOT)/ace/Message_Block.i \ + $(ACE_ROOT)/ace/Message_Block_T.h \ + $(ACE_ROOT)/ace/Message_Block_T.i \ + $(ACE_ROOT)/ace/Message_Block_T.cpp \ + $(ACE_ROOT)/ace/CDR_Base.inl \ + $(TAO_ROOT)/tao/try_macros.h \ + $(TAO_ROOT)/tao/orbconf.h \ + $(ACE_ROOT)/ace/CORBA_macros.h \ + $(TAO_ROOT)/tao/varbase.h \ + $(TAO_ROOT)/tao/TAO_Export.h \ + $(TAO_ROOT)/tao/corbafwd.i \ + $(TAO_ROOT)/tao/Typecode.h \ + $(TAO_ROOT)/tao/Exception.h \ + $(ACE_ROOT)/ace/SString.h \ + $(ACE_ROOT)/ace/SString.i \ + $(TAO_ROOT)/tao/Exception.i \ + $(TAO_ROOT)/tao/Typecode.i \ + $(TAO_ROOT)/tao/Any.h \ + $(TAO_ROOT)/tao/CDR.h \ + $(ACE_ROOT)/ace/CDR_Stream.h \ + $(ACE_ROOT)/ace/CDR_Stream.i \ + $(TAO_ROOT)/tao/CDR.i \ + $(TAO_ROOT)/tao/Environment.h \ + $(TAO_ROOT)/tao/Environment.i \ + $(TAO_ROOT)/tao/Object.h \ + $(TAO_ROOT)/tao/Object_Proxy_Broker.h \ + $(TAO_ROOT)/tao/Object_Proxy_Impl.h \ + $(TAO_ROOT)/tao/Object.i \ + $(TAO_ROOT)/tao/Any.i \ + $(TAO_ROOT)/tao/NVList.h \ + $(ACE_ROOT)/ace/Unbounded_Queue.h \ + $(ACE_ROOT)/ace/Unbounded_Queue.inl \ + $(ACE_ROOT)/ace/Unbounded_Queue.cpp \ + $(TAO_ROOT)/tao/NVList.i \ + $(TAO_ROOT)/tao/LocalObject.h \ + $(TAO_ROOT)/tao/LocalObject.i \ + $(TAO_ROOT)/tao/Principal.h \ + $(TAO_ROOT)/tao/OctetSeqC.h \ + $(TAO_ROOT)/tao/Sequence.h \ + $(TAO_ROOT)/tao/Managed_Types.h \ + $(TAO_ROOT)/tao/Managed_Types.i \ + $(TAO_ROOT)/tao/Sequence.i \ + $(TAO_ROOT)/tao/Sequence_T.h \ + $(TAO_ROOT)/tao/Sequence_T.i \ + $(TAO_ROOT)/tao/Sequence_T.cpp \ + $(TAO_ROOT)/tao/OctetSeqC.i \ + $(TAO_ROOT)/tao/Principal.i \ + $(TAO_ROOT)/tao/ORB.h \ + $(TAO_ROOT)/tao/Services.h \ + $(TAO_ROOT)/tao/Services.i \ + $(TAO_ROOT)/tao/CORBA_String.h \ + $(TAO_ROOT)/tao/CORBA_String.inl \ + $(TAO_ROOT)/tao/PolicyC.h \ + $(TAO_ROOT)/tao/Encodable.h \ + $(TAO_ROOT)/tao/Remote_Object_Proxy_Impl.h \ + $(TAO_ROOT)/tao/CurrentC.h \ + $(TAO_ROOT)/tao/CurrentC.i \ + $(TAO_ROOT)/tao/PolicyC.i \ + $(TAO_ROOT)/tao/ORB.i \ + $(TAO_ROOT)/tao/BoundsC.h \ + $(TAO_ROOT)/tao/BoundsC.i \ + $(TAO_ROOT)/tao/ValueBase.h \ + $(TAO_ROOT)/tao/ValueBase.i \ + $(TAO_ROOT)/tao/ValueFactory.h \ + $(TAO_ROOT)/tao/ValueFactory.i \ + $(TAO_ROOT)/tao/DomainC.h \ + $(TAO_ROOT)/tao/DomainC.i \ + $(TAO_ROOT)/tao/WrongTransactionC.h \ + $(TAO_ROOT)/tao/Object_KeyC.h \ + $(TAO_ROOT)/tao/Object_KeyC.i \ + $(TAO_ROOT)/tao/ObjectIDList.h \ + $(TAO_ROOT)/tao/ObjectIDList.i \ + $(TAO_ROOT)/tao/StringSeqC.h \ + $(TAO_ROOT)/tao/StringSeqC.i \ + $(TAO_ROOT)/tao/PortableInterceptorC.h \ + $(TAO_ROOT)/tao/DynamicC.h \ + $(TAO_ROOT)/tao/DynamicC.i \ + $(TAO_ROOT)/tao/MessagingC.h \ + $(TAO_ROOT)/tao/TimeBaseC.h \ + $(TAO_ROOT)/tao/SmartProxies/Smart_Proxies.h \ + $(TAO_ROOT)/tao/SmartProxies/smartproxies_export.h \ + $(TAO_ROOT)/tao/TAO_Singleton.h \ + $(TAO_ROOT)/tao/TAO_Singleton.inl \ + $(TAO_ROOT)/tao/TAO_Singleton.cpp \ + $(ACE_ROOT)/ace/Object_Manager.h \ + $(ACE_ROOT)/ace/Object_Manager.i \ + $(ACE_ROOT)/ace/Managed_Object.h \ + $(ACE_ROOT)/ace/Managed_Object.i \ + $(ACE_ROOT)/ace/Managed_Object.cpp \ + $(TAO_ROOT)/tao/TAO_Singleton_Manager.h \ + $(TAO_ROOT)/tao/TAO_Singleton_Manager.inl \ + $(TAO_ROOT)/tao/SmartProxies/Smart_Proxies.inl \ + $(TAO_ROOT)/tao/TimeBaseC.i \ + $(TAO_ROOT)/tao/IOPC.h \ + $(TAO_ROOT)/tao/IOPC.i \ + $(TAO_ROOT)/tao/PollableC.h \ + $(TAO_ROOT)/tao/PollableC.i \ + $(TAO_ROOT)/tao/MessagingC.i \ + $(TAO_ROOT)/tao/PortableInterceptorC.i \ + $(TAO_ROOT)/tao/RTCORBA/RTCORBA.h \ + $(TAO_ROOT)/tao/RTCORBA/rtcorba_export.h \ + $(TAO_ROOT)/tao/RTCORBA/RTCORBAC.h \ + $(TAO_ROOT)/tao/RTCORBA/RTCORBAC.i \ + $(ACE_ROOT)/ace/Get_Opt.h \ + $(ACE_ROOT)/ace/Get_Opt.i + +# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/TAO/tests/RTCORBA/ORB_init/Makefile.bor b/TAO/tests/RTCORBA/ORB_init/Makefile.bor new file mode 100644 index 00000000000..5f57de49f22 --- /dev/null +++ b/TAO/tests/RTCORBA/ORB_init/Makefile.bor @@ -0,0 +1,27 @@ +# +# Makefile for building the Server_Protocol server +# + +NAME = ORB_init + + +OBJFILES = \ + $(OBJDIR)\ORB_init.obj + +CFLAGS = \ + $(ACE_CFLAGS) \ + $(TAO_CFLAGS) \ + $(TAO_RTCORBA_CFLAGS) + +LIBFILES = \ + $(ACE_LIB) \ + $(TAO_LIB) \ + $(TAO_RTCORBA_LIB) + +CPPDIR = . + +IDLDIR = . + +!include <$(ACE_ROOT)\include\makeinclude\build_exe.bor> +!include <$(ACE_ROOT)\include\makeinclude\recurse.bor> + diff --git a/TAO/tests/RTCORBA/ORB_init/ORB_init.cpp b/TAO/tests/RTCORBA/ORB_init/ORB_init.cpp new file mode 100644 index 00000000000..82f1bf3c983 --- /dev/null +++ b/TAO/tests/RTCORBA/ORB_init/ORB_init.cpp @@ -0,0 +1,132 @@ +// $Id$ + +#include "tao/corba.h" +#include "tao/RTCORBA/RTCORBA.h" +#include "ace/Get_Opt.h" + +int +test_multiple_orbs (const char *test_name, + int argc, + char *argv[], + int iterations, + int rt_orb, + int destroy) +{ + CORBA::ORB_var *orbs = + new CORBA::ORB_var[iterations]; + + RTCORBA::RTORB_var *rt_orbs = + new RTCORBA::RTORB_var[iterations]; + + ACE_TRY_NEW_ENV + { + for (int i = 0; + i < iterations; + ++i) + { + char name[100]; + ACE_OS::sprintf (name, "%s %d", test_name, i); + + orbs[i] = + CORBA::ORB_init (argc, + argv, + name, + ACE_TRY_ENV); + ACE_TRY_CHECK; + + if (rt_orb) + { + CORBA::Object_var object = + orbs[i]->resolve_initial_references ("RTORB", + ACE_TRY_ENV); + ACE_TRY_CHECK; + + rt_orbs[i] = + RTCORBA::RTORB::_narrow (object.in (), + ACE_TRY_ENV); + ACE_TRY_CHECK; + + ACE_ASSERT (rt_orbs[i].in () != RTCORBA::RTORB::_nil ()); + } + } + + if (destroy) + { + for (int i = 0; + i < iterations; + ++i) + { + orbs[i]->destroy (ACE_TRY_ENV); + ACE_TRY_CHECK; + } + } + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Unexpected exception caught in ORB_init"); + return -1; + } + ACE_ENDTRY; + + delete[] rt_orbs; + delete[] orbs; + + return 0; +} + +int +main (int argc, char *argv[]) +{ + int iterations = 5; + int result = 0; + int rt_orb = 0; + int destroy = 0; + + result = + test_multiple_orbs ("non-RT ORBs, disable destroy", + argc, + argv, + iterations, + rt_orb, + destroy); + ACE_ASSERT (result == 0); + + destroy = 1; + rt_orb = 0; + + result = + test_multiple_orbs ("non-RT ORBs, enable destroy", + argc, + argv, + iterations, + rt_orb, + destroy); + ACE_ASSERT (result == 0); + + destroy = 0; + rt_orb = 1; + + result = + test_multiple_orbs ("RT ORBs, disable destroy", + argc, + argv, + iterations, + rt_orb, + destroy); + ACE_ASSERT (result == 0); + + destroy = 1; + rt_orb = 1; + + result = + test_multiple_orbs ("RT ORBs, enable destroy", + argc, + argv, + iterations, + rt_orb, + destroy); + ACE_ASSERT (result == 0); + + return 0; +} diff --git a/TAO/tests/RTCORBA/ORB_init/ORB_init.dsp b/TAO/tests/RTCORBA/ORB_init/ORB_init.dsp new file mode 100644 index 00000000000..a8d997fb955 --- /dev/null +++ b/TAO/tests/RTCORBA/ORB_init/ORB_init.dsp @@ -0,0 +1,103 @@ +# Microsoft Developer Studio Project File - Name="ORB_init" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=ORB_init - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "ORB_init.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "ORB_init.mak" CFG="ORB_init - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "ORB_init - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "ORB_init - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "ORB_init - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MD /W3 /GX /O2 /I "..\..\\" /I "..\..\..\\" /I "..\..\..\..\\" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ace.lib TAO.lib TAO_RTCORBA.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\tao" /libpath:"..\..\..\..\ace" /libpath:"..\..\..\tao\RTCORBA"
+
+!ELSEIF "$(CFG)" == "ORB_init - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\..\\" /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
+# SUBTRACT CPP /YX
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 TAO_RTCORBAd.lib TAOd.lib aced.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\tao" /libpath:"..\..\..\..\ace" /libpath:"..\..\..\tao\RTCORBA"
+
+!ENDIF
+
+# Begin Target
+
+# Name "ORB_init - Win32 Release"
+# Name "ORB_init - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\ORB_init.cpp
+# End Source File
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+
+# End Group
+# Begin Group "Inline Files"
+
+# PROP Default_Filter "i"
+# End Group
+# End Target
+# End Project
diff --git a/TAO/tests/RTCORBA/ORB_init/README b/TAO/tests/RTCORBA/ORB_init/README new file mode 100644 index 00000000000..c7aa666a92e --- /dev/null +++ b/TAO/tests/RTCORBA/ORB_init/README @@ -0,0 +1,6 @@ +$Id$ + +This is a unit test for the creation of multiple RT ORBs. + + + diff --git a/TAO/tests/RTCORBA/ORB_init/run_test.pl b/TAO/tests/RTCORBA/ORB_init/run_test.pl new file mode 100755 index 00000000000..0d351700807 --- /dev/null +++ b/TAO/tests/RTCORBA/ORB_init/run_test.pl @@ -0,0 +1,22 @@ +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# $Id$ +# -*- perl -*- + +use lib '../../../../bin'; +use PerlACE::Run_Test; + +print STDERR "\n********** RTCORBA ORB_init Unit Test **********\n\n"; + +$T = new PerlACE::Process ("ORB_init"); + +$test = $T->SpawnWaitKill (60); + +if ($test != 0) { + print STDERR "ERROR: test returned $test\n"; + exit 1; +} + +exit 0; diff --git a/TAO/tests/RTCORBA/Private_Connection/svc.conf b/TAO/tests/RTCORBA/Private_Connection/svc.conf deleted file mode 100644 index d264034e12c..00000000000 --- a/TAO/tests/RTCORBA/Private_Connection/svc.conf +++ /dev/null @@ -1 +0,0 @@ -static RT_ORB_Loader ""
\ No newline at end of file diff --git a/TAO/tests/RTCORBA/README b/TAO/tests/RTCORBA/README index bf7fa2db2ff..b340e6e3b48 100644 --- a/TAO/tests/RTCORBA/README +++ b/TAO/tests/RTCORBA/README @@ -60,3 +60,8 @@ includes the following: . Thread_Pool Tests the creation and use of thread pools. + + . ORB_init + + Tests the creation and destruction of multiple RT enabled ORBs. + diff --git a/TAO/tests/RTCORBA/Server_Declared/server.conf b/TAO/tests/RTCORBA/Server_Declared/server.conf index d7aeb5a6bf1..1a3860c473e 100644 --- a/TAO/tests/RTCORBA/Server_Declared/server.conf +++ b/TAO/tests/RTCORBA/Server_Declared/server.conf @@ -1,4 +1,3 @@ # $Id$ # static Advanced_Resource_Factory "-ORBReactorType tp -ORBReactorRegistry per-priority" -static RT_ORB_Loader "" diff --git a/TAO/tests/RTCORBA/Server_Declared/svc.conf b/TAO/tests/RTCORBA/Server_Declared/svc.conf deleted file mode 100644 index d264034e12c..00000000000 --- a/TAO/tests/RTCORBA/Server_Declared/svc.conf +++ /dev/null @@ -1 +0,0 @@ -static RT_ORB_Loader ""
\ No newline at end of file diff --git a/TAO/tests/RTCORBA/Server_Protocol/server_iiop.conf b/TAO/tests/RTCORBA/Server_Protocol/server_iiop.conf index cb3861ac9e8..5a4531515d6 100644 --- a/TAO/tests/RTCORBA/Server_Protocol/server_iiop.conf +++ b/TAO/tests/RTCORBA/Server_Protocol/server_iiop.conf @@ -1,3 +1,2 @@ # static Advanced_Resource_Factory "-ORBProtocolFactory IIOP_Factory" -static RT_ORB_Loader "" diff --git a/TAO/tests/RTCORBA/Server_Protocol/server_reverse.conf b/TAO/tests/RTCORBA/Server_Protocol/server_reverse.conf index 9577811627a..5ecb4523212 100644 --- a/TAO/tests/RTCORBA/Server_Protocol/server_reverse.conf +++ b/TAO/tests/RTCORBA/Server_Protocol/server_reverse.conf @@ -3,4 +3,3 @@ # static SHMIOP_Factory "-MMAPFilePrefix server_shmiop" static Advanced_Resource_Factory "-ORBProtocolFactory SHMIOP_Factory -ORBProtocolFactory UIOP_Factory -ORBProtocolFactory IIOP_Factory " -static RT_ORB_Loader "" diff --git a/TAO/tests/RTCORBA/Server_Protocol/server_reverse_nt.conf b/TAO/tests/RTCORBA/Server_Protocol/server_reverse_nt.conf index bf0c338efc5..89d39d453c8 100644 --- a/TAO/tests/RTCORBA/Server_Protocol/server_reverse_nt.conf +++ b/TAO/tests/RTCORBA/Server_Protocol/server_reverse_nt.conf @@ -3,5 +3,3 @@ # static SHMIOP_Factory "-MMAPFilePrefix server_shmiop" static Advanced_Resource_Factory "-ORBProtocolFactory SHMIOP_Factory -ORBProtocolFactory IIOP_Factory" - -static RT_ORB_Loader "" diff --git a/TAO/tests/RTCORBA/Server_Protocol/server_shmiop.conf b/TAO/tests/RTCORBA/Server_Protocol/server_shmiop.conf index d337a12262c..20225cd6bc3 100644 --- a/TAO/tests/RTCORBA/Server_Protocol/server_shmiop.conf +++ b/TAO/tests/RTCORBA/Server_Protocol/server_shmiop.conf @@ -3,4 +3,3 @@ # static SHMIOP_Factory "-MMAPFilePrefix server_shmiop" static Advanced_Resource_Factory "-ORBProtocolFactory SHMIOP_Factory " -static RT_ORB_Loader "" diff --git a/TAO/tests/RTCORBA/Server_Protocol/svc.conf b/TAO/tests/RTCORBA/Server_Protocol/svc.conf deleted file mode 100644 index 33dcdf90224..00000000000 --- a/TAO/tests/RTCORBA/Server_Protocol/svc.conf +++ /dev/null @@ -1,2 +0,0 @@ -static RT_ORB_Loader "" - diff --git a/TAO/tests/RTCORBA/Thread_Pool/svc.conf b/TAO/tests/RTCORBA/Thread_Pool/svc.conf deleted file mode 100644 index d264034e12c..00000000000 --- a/TAO/tests/RTCORBA/Thread_Pool/svc.conf +++ /dev/null @@ -1 +0,0 @@ -static RT_ORB_Loader ""
\ No newline at end of file |