diff options
author | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-08-29 18:22:44 +0000 |
---|---|---|
committer | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-08-29 18:22:44 +0000 |
commit | bab3eeeaf0e1e548075422c3b5ff4236d2086620 (patch) | |
tree | ee8d3d318403ad545ff9c452ded7ad0ab1482793 | |
parent | 30ce3759632417cfa6a916fb63671e5067a0bd84 (diff) | |
download | ATCD-bab3eeeaf0e1e548075422c3b5ff4236d2086620.tar.gz |
New collocation scheme to deal with collocated calls across thread lanes.
30 files changed, 1375 insertions, 68 deletions
diff --git a/TAO/tao/Collocation_Resolver.cpp b/TAO/tao/Collocation_Resolver.cpp new file mode 100644 index 00000000000..0cbc7c4847f --- /dev/null +++ b/TAO/tao/Collocation_Resolver.cpp @@ -0,0 +1,24 @@ +// $Id$ + +#include "tao/Collocation_Resolver.h" +#include "ace/Dynamic_Service.h" + +ACE_RCSID(tao, Collocation_Resolver, "$Id$") + +#if !defined (__ACE_INLINE__) +# include "tao/Collocation_Resolver.i" +#endif /* ! __ACE_INLINE__ */ + +TAO_Collocation_Resolver::~TAO_Collocation_Resolver (void) +{ +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + +template class ACE_Dynamic_Service<TAO_Collocation_Resolver>; + +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +#pragma instantiate ACE_Dynamic_Service<TAO_Collocation_Resolver> + +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/tao/Collocation_Resolver.h b/TAO/tao/Collocation_Resolver.h new file mode 100644 index 00000000000..e4e391d0c12 --- /dev/null +++ b/TAO/tao/Collocation_Resolver.h @@ -0,0 +1,50 @@ +//============================================================================= +/** + * @file Collocation_Resolver.h + * + * $Id$ + * + * @author Irfan Pyarali + */ +// =================================================================== + +#ifndef TAO_COLLOCATION_RESOLVER_H +#define TAO_COLLOCATION_RESOLVER_H + +#include "ace/pre.h" +#include "tao/orbconf.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/corbafwd.h" +#include "ace/Service_Object.h" + +/** + * @class TAO_Collocation_Resolver + * + * @brief This class helps in resolving if a CORBA:Object is collocated. + * + * \nosubgrouping + * + **/ +class TAO_Export TAO_Collocation_Resolver + : public ACE_Service_Object +{ +public: + + /// Destructor. + virtual ~TAO_Collocation_Resolver (void); + + /// Is <object> collocated? + virtual CORBA::Boolean is_collocated (CORBA::Object_ptr object) const = 0; +}; + +#if defined (__ACE_INLINE__) +# include "tao/Collocation_Resolver.i" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" + +#endif /* TAO_COLLOCATION_RESOLVER_H */ diff --git a/TAO/tao/Collocation_Resolver.i b/TAO/tao/Collocation_Resolver.i new file mode 100644 index 00000000000..cfa1da318d3 --- /dev/null +++ b/TAO/tao/Collocation_Resolver.i @@ -0,0 +1 @@ +// $Id$ diff --git a/TAO/tao/Default_Collocation_Resolver.cpp b/TAO/tao/Default_Collocation_Resolver.cpp new file mode 100644 index 00000000000..95a6a21c2b3 --- /dev/null +++ b/TAO/tao/Default_Collocation_Resolver.cpp @@ -0,0 +1,25 @@ +// $Id$ + +#include "tao/Default_Collocation_Resolver.h" + +ACE_RCSID(tao, Default_Collocation_Resolver, "$Id$") + +#include "tao/Object.h" + +#if !defined (__ACE_INLINE__) +# include "tao/Default_Collocation_Resolver.i" +#endif /* ! __ACE_INLINE__ */ + +CORBA::Boolean +TAO_Default_Collocation_Resolver::is_collocated (CORBA::Object_ptr object) const +{ + return object->_is_collocated (); +} + +ACE_STATIC_SVC_DEFINE (TAO_Default_Collocation_Resolver, + ACE_TEXT ("Default_Collocation_Resolver"), + ACE_SVC_OBJ_T, + &ACE_SVC_NAME (TAO_Default_Collocation_Resolver), + ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, + 0) +ACE_FACTORY_DEFINE (TAO, TAO_Default_Collocation_Resolver) diff --git a/TAO/tao/Default_Collocation_Resolver.h b/TAO/tao/Default_Collocation_Resolver.h new file mode 100644 index 00000000000..8ec1ca4af09 --- /dev/null +++ b/TAO/tao/Default_Collocation_Resolver.h @@ -0,0 +1,51 @@ +//============================================================================= +/** + * @file Default_Collocation_Resolver.h + * + * $Id$ + * + * @author Irfan Pyarali + */ +// =================================================================== + +#ifndef TAO_DEFAULT_COLLOCATION_RESOLVER_H +#define TAO_DEFAULT_COLLOCATION_RESOLVER_H + +#include "ace/pre.h" +#include "tao/orbconf.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/Collocation_Resolver.h" +#include "ace/Service_Config.h" + +/** + * @class TAO_Default_Collocation_Resolver + * + * @brief Simple resolver used to decide if a CORBA::Object is + * collocated. + * + * \nosubgrouping + * + **/ +class TAO_Export TAO_Default_Collocation_Resolver : + public TAO_Collocation_Resolver +{ +public: + + /// Is <object> collocated? + virtual CORBA::Boolean is_collocated (CORBA::Object_ptr object) const; +}; + +ACE_STATIC_SVC_DECLARE_EXPORT (TAO, TAO_Default_Collocation_Resolver) +ACE_FACTORY_DECLARE (TAO, TAO_Default_Collocation_Resolver) + +#if defined (__ACE_INLINE__) +# include "tao/Default_Collocation_Resolver.i" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" + +#endif /* TAO_DEFAULT_COLLOCATION_RESOLVER_H */ diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp index 28e9da2aa40..2ef6eb0c4a4 100644 --- a/TAO/tao/ORB_Core.cpp +++ b/TAO/tao/ORB_Core.cpp @@ -27,9 +27,8 @@ #include "tao/Thread_Lane_Resources.h" #include "tao/Thread_Lane_Resources_Manager.h" -#include "Default_Stub_Factory.h" -#include "Default_Endpoint_Selector_Factory.h" -#include "Default_Protocols_Hooks.h" +#include "tao/Collocation_Resolver.h" +#include "tao/Stub_Factory.h" #include "IORInfo.h" @@ -73,6 +72,8 @@ const char * TAO_ORB_Core::endpoint_selector_factory_name_ = "Default_Endpoint_Selector_Factory"; const char * TAO_ORB_Core::thread_lane_resources_manager_factory_name_ = "Default_Thread_Lane_Resources_Manager_Factory"; +const char * TAO_ORB_Core::collocation_resolver_name_ = + "Default_Collocation_Resolver"; const char * TAO_ORB_Core::stub_factory_name_ = "Default_Stub_Factory"; const char * TAO_ORB_Core::resource_factory_name_ = @@ -95,6 +96,7 @@ TAO_ORB_Core::TAO_ORB_Core (const char *orbid) lock_ (), connector_registry_ (0), thread_lane_resources_manager_ (0), + collocation_resolver_ (0), stub_factory_ (0), protocol_factories_ (0), implrepo_service_ (CORBA::Object::_nil ()), @@ -1138,6 +1140,13 @@ TAO_ORB_Core::set_thread_lane_resources_manager_factory (const char *thread_lane } void +TAO_ORB_Core::set_collocation_resolver (const char *collocation_resolver_name) +{ + TAO_ORB_Core::collocation_resolver_name_ = + collocation_resolver_name; +} + +void TAO_ORB_Core::set_stub_factory (const char *stub_factory_name) { TAO_ORB_Core::stub_factory_name_ = stub_factory_name; @@ -1218,6 +1227,21 @@ TAO_ORB_Core::thread_lane_resources_manager (void) return *this->thread_lane_resources_manager_; } +TAO_Collocation_Resolver & +TAO_ORB_Core::collocation_resolver (void) +{ + // Check if there is a cached reference. + if (this->collocation_resolver_ != 0) + return *this->collocation_resolver_; + + // If not, lookup it up. + this->collocation_resolver_ = + ACE_Dynamic_Service<TAO_Collocation_Resolver>::instance + (TAO_ORB_Core::collocation_resolver_name_); + + return *this->collocation_resolver_; +} + TAO_Stub_Factory * TAO_ORB_Core::stub_factory (void) { @@ -2813,7 +2837,7 @@ TAO_ORB_Core::collocation_strategy (CORBA::Object_ptr object) TAO_Stub *stub = object->_stubobj (); if (!CORBA::is_nil (stub->servant_orb_var ().in ()) && stub->servant_orb_var ()->orb_core () != 0 && - object->_is_collocated () == 1) + stub->servant_orb_var ()->orb_core ()->collocation_resolver ().is_collocated (object)) { switch (stub->servant_orb_var ()->orb_core ()->get_collocation_strategy ()) { diff --git a/TAO/tao/ORB_Core.h b/TAO/tao/ORB_Core.h index 8dadda6776c..331a83fc42a 100644 --- a/TAO/tao/ORB_Core.h +++ b/TAO/tao/ORB_Core.h @@ -73,6 +73,7 @@ class TAO_BiDir_Adapter; class TAO_Flushing_Strategy; class TAO_Thread_Lane_Resources_Manager; +class TAO_Collocation_Resolver; class TAO_Thread_Lane_Resources; class TAO_Stub_Factory; class TAO_Endpoint_Selector_Factory; @@ -353,6 +354,9 @@ public: /// Returns a pointer to the Thread Lane Resources Manager. TAO_Thread_Lane_Resources_Manager &thread_lane_resources_manager (void); + /// Returns a pointer to the Collocation Resolver. + TAO_Collocation_Resolver &collocation_resolver (void); + /// Returns a pointer to the Stub factory. TAO_Stub_Factory *stub_factory (void); @@ -364,6 +368,9 @@ public: /// Sets the value of TAO_ORB_Core::thread_lane_resources_manager_factory_name_ static void set_thread_lane_resources_manager_factory (const char *thread_lane_resources_manager_factory_name); + /// Sets the value of TAO_ORB_Core::collocation_resolver_name_ + static void set_collocation_resolver (const char *collocation_resolver_name); + /// Sets the value of TAO_ORB_Core::stub_factory_name_ static void set_stub_factory (const char *stub_factory_name); @@ -924,6 +931,8 @@ protected: TAO_Thread_Lane_Resources_Manager *thread_lane_resources_manager_; + TAO_Collocation_Resolver *collocation_resolver_; + TAO_Stub_Factory *stub_factory_; /// Pointer to the list of protocol loaded into this ORB instance. @@ -1007,6 +1016,12 @@ protected: // "RT_Thread_Lane_Resources_Manager_Factory". static const char *thread_lane_resources_manager_factory_name_; + // Name of the collocation resolver that needs to be instantiated. + // The default value is "Default_Collocation_Resolver". If + // TAO_RTCORBA is linked, the set_collocation_resolver will be + // called to set the value to be "RT_Collocation_Resolver". + static const char *collocation_resolver_name_; + // Name of the stub factory that needs to be instantiated. // The default value is "Default_Stub_Factory". If TAO_RTCORBA is // linked, the set_stub_factory will be called to set the value diff --git a/TAO/tao/PortableServer/Object_Adapter.cpp b/TAO/tao/PortableServer/Object_Adapter.cpp index f62be74a285..db0153b758f 100644 --- a/TAO/tao/PortableServer/Object_Adapter.cpp +++ b/TAO/tao/PortableServer/Object_Adapter.cpp @@ -1269,6 +1269,37 @@ TAO_Object_Adapter::Servant_Upcall::prepare_for_upcall (const TAO_ObjectKey &key return TAO_Adapter::DS_OK; } +TAO_POA * +TAO_Object_Adapter::Servant_Upcall::lookup_POA (const TAO_ObjectKey &key, + CORBA::Environment &ACE_TRY_ENV) +{ + // Acquire the object adapter lock first. + int result = this->object_adapter_->lock ().acquire (); + if (result == -1) + // Locking error. + ACE_THROW_RETURN (CORBA::OBJ_ADAPTER (), + 0); + + // We have acquired the object adapater lock. Record this for later + // use. + this->state_ = OBJECT_ADAPTER_LOCK_ACQUIRED; + + // Check if a non-servant upcall is in progress. If a non-servant + // upcall is in progress, wait for it to complete. Unless of + // course, the thread making the non-servant upcall is this thread. + this->object_adapter_->wait_for_non_servant_upcalls_to_complete (ACE_TRY_ENV); + ACE_CHECK_RETURN (TAO_Adapter::DS_FAILED); + + // Locate the POA. + this->object_adapter_->locate_poa (key, + this->system_id_, + this->poa_, + ACE_TRY_ENV); + ACE_CHECK_RETURN (0); + + return this->poa_; +} + TAO_Object_Adapter::Servant_Upcall::~Servant_Upcall () { switch (this->state_) diff --git a/TAO/tao/PortableServer/Object_Adapter.h b/TAO/tao/PortableServer/Object_Adapter.h index 4d7fed74507..32301fdbdf5 100644 --- a/TAO/tao/PortableServer/Object_Adapter.h +++ b/TAO/tao/PortableServer/Object_Adapter.h @@ -622,6 +622,7 @@ public: public: friend class TAO_POA; + friend class TAO_RT_Collocation_Resolver; // @@ PPOA: Servant_Upcall (TAO_Object_Adapter &object_adapter); Servant_Upcall (TAO_ORB_Core *orb_core); @@ -636,6 +637,10 @@ public: CORBA::Environment &ACE_TRY_ENV = TAO_default_environment ()); // Locate POA and servant. + TAO_POA *lookup_POA (const TAO_ObjectKey &key, + CORBA::Environment &ACE_TRY_ENV); + // Locate POA. + TAO_POA &poa (void) const; // POA accessor. diff --git a/TAO/tao/PortableServer/POA.h b/TAO/tao/PortableServer/POA.h index b7b1e559098..a72790868e3 100644 --- a/TAO/tao/PortableServer/POA.h +++ b/TAO/tao/PortableServer/POA.h @@ -138,6 +138,7 @@ public: friend class TAO_Object_Adapter::Non_Servant_Upcall; friend class TAO_POA_Current_Impl; friend class TAO_POA_Manager; + friend class TAO_RT_Collocation_Resolver; typedef ACE_CString String; diff --git a/TAO/tao/RTCORBA/RT_ORBInitializer.cpp b/TAO/tao/RTCORBA/RT_ORBInitializer.cpp index d7246ffd098..83d76cbcb6b 100644 --- a/TAO/tao/RTCORBA/RT_ORBInitializer.cpp +++ b/TAO/tao/RTCORBA/RT_ORBInitializer.cpp @@ -52,19 +52,19 @@ TAO_RT_ORBInitializer::pre_init ( // Register all of the RT related services. // - // Set the name of the Protocol_Hooks to be the RT_Protocols_Hooks. + // Set the name of the Protocol_Hooks to be RT_Protocols_Hooks. TAO_ORB_Core::set_protocols_hooks ("RT_Protocols_Hooks"); ACE_Service_Config::process_directive (ace_svc_desc_TAO_RT_Protocols_Hooks); - // Set the name of the stub factory to be the RT_Stub_Factory. + // Set the name of the stub factory to be RT_Stub_Factory. TAO_ORB_Core::set_stub_factory ("RT_Stub_Factory"); ACE_Service_Config::process_directive (ace_svc_desc_TAO_RT_Stub_Factory); - // Set the name of the stub factory to be the RT_Stub_Factory. + // Set the name of the stub factory to be RT_Stub_Factory. TAO_ORB_Core::set_endpoint_selector_factory ("RT_Endpoint_Selector_Factory"); ACE_Service_Config::process_directive (ace_svc_desc_RT_Endpoint_Selector_Factory); - // Set the name of the thread lane resources manager to be the RT_Thread_Lane_Resources_Manager. + // Set the name of the thread lane resources manager to be RT_Thread_Lane_Resources_Manager. TAO_ORB_Core::set_thread_lane_resources_manager_factory ("RT_Thread_Lane_Resources_Manager_Factory"); ACE_Service_Config::process_directive (ace_svc_desc_TAO_RT_Thread_Lane_Resources_Manager_Factory); diff --git a/TAO/tao/RTPortableServer/RT_Collocation_Resolver.cpp b/TAO/tao/RTPortableServer/RT_Collocation_Resolver.cpp new file mode 100644 index 00000000000..f394b54e0db --- /dev/null +++ b/TAO/tao/RTPortableServer/RT_Collocation_Resolver.cpp @@ -0,0 +1,93 @@ +// $Id$ + +#include "tao/RTPortableServer/RT_Collocation_Resolver.h" + +ACE_RCSID(RTCORBA, RT_Collocation_Resolver, "$Id$") + +#include "tao/ORB_Core.h" +#include "tao/Object.h" +#include "tao/Stub.h" +#include "tao/PortableServer/Object_Adapter.h" +#include "tao/PortableServer/POA.h" +#include "tao/RTCORBA/Thread_Pool.h" + +#if !defined (__ACE_INLINE__) +# include "tao/RTPortableServer/RT_Collocation_Resolver.i" +#endif /* ! __ACE_INLINE__ */ + +CORBA::Boolean +TAO_RT_Collocation_Resolver::is_collocated (CORBA::Object_ptr object) const +{ + if (!object->_is_collocated ()) + return 0; + + ACE_DECLARE_NEW_CORBA_ENV; + + TAO_ORB_Core *orb_core = + object->_stubobj ()->servant_orb_var ()->orb_core (); + + TAO_Object_Adapter::Servant_Upcall servant_upcall (orb_core); + TAO_POA *poa = + servant_upcall.lookup_POA (object->_object_key (), + ACE_TRY_ENV); + ACE_CHECK_RETURN (0); + + TAO_Thread_Pool *target_thread_pool = + (TAO_Thread_Pool *) poa->thread_pool (); + + /// Get the ORB_Core's TSS resources. + TAO_ORB_Core_TSS_Resources &tss = + *orb_core->get_tss_resources (); + + // Get the lane for this thread. + TAO_Thread_Lane *current_thread_lane = + (TAO_Thread_Lane *) tss.lane_; + + TAO_Thread_Pool *current_thread_pool = 0; + + // If we don't have a lane, we don't have a pool. + if (current_thread_lane) + current_thread_pool = + ¤t_thread_lane->pool (); + + if (current_thread_pool != target_thread_pool) + return 0; + + if (current_thread_pool == 0) + return 1; + + if (!current_thread_pool->with_lanes ()) + return 1; + + TAO_POA_Cached_Policies &cached_policies = + poa->cached_policies (); + + TAO_POA_Cached_Policies::PriorityModel priority_model = + cached_policies.priority_model (); + + if (priority_model == TAO_POA_Cached_Policies::CLIENT_PROPAGATED) + return 1; + + poa->locate_servant_i ("operation not used", + servant_upcall.system_id_, + servant_upcall, + servant_upcall.current_context_, + ACE_TRY_ENV); + ACE_CHECK_RETURN (0); + + CORBA::Short target_priority = + servant_upcall.priority (); + + if (target_priority == current_thread_lane->lane_priority ()) + return 1; + else + return 0; +} + +ACE_STATIC_SVC_DEFINE (TAO_RT_Collocation_Resolver, + ACE_TEXT ("RT_Collocation_Resolver"), + ACE_SVC_OBJ_T, + &ACE_SVC_NAME (TAO_RT_Collocation_Resolver), + ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, + 0) +ACE_FACTORY_DEFINE (TAO, TAO_RT_Collocation_Resolver) diff --git a/TAO/tao/RTPortableServer/RT_Collocation_Resolver.h b/TAO/tao/RTPortableServer/RT_Collocation_Resolver.h new file mode 100644 index 00000000000..bd625bb8165 --- /dev/null +++ b/TAO/tao/RTPortableServer/RT_Collocation_Resolver.h @@ -0,0 +1,52 @@ +//============================================================================= +/** + * @file RT_Collocation_Resolver.h + * + * $Id$ + * + * @author Irfan Pyarali + */ +// =================================================================== + +#ifndef TAO_RT_COLLOCATION_RESOLVER_H +#define TAO_RT_COLLOCATION_RESOLVER_H + +#include "ace/pre.h" +#include "tao/orbconf.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/RTPortableServer/rtportableserver_export.h" +#include "tao/Collocation_Resolver.h" +#include "ace/Service_Config.h" + +/** + * @class TAO_RT_Collocation_Resolver + * + * @brief This class helps decide on collocation among the maze of + * thread pools and lanes. + * + * \nosubgrouping + * + **/ +class TAO_RTPortableServer_Export TAO_RT_Collocation_Resolver : + public TAO_Collocation_Resolver +{ +public: + + /// Is <object> collocated? + virtual CORBA::Boolean is_collocated (CORBA::Object_ptr object) const; +}; + +ACE_STATIC_SVC_DECLARE_EXPORT (TAO_RTPortableServer, TAO_RT_Collocation_Resolver) +ACE_FACTORY_DECLARE (TAO_RTPortableServer, TAO_RT_Collocation_Resolver) + +#if defined (__ACE_INLINE__) +# include "tao/RTPortableServer/RT_Collocation_Resolver.i" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" + +#endif /* TAO_RT_COLLOCATION_RESOLVER_H */ diff --git a/TAO/tao/RTPortableServer/RT_Collocation_Resolver.i b/TAO/tao/RTPortableServer/RT_Collocation_Resolver.i new file mode 100644 index 00000000000..cfa1da318d3 --- /dev/null +++ b/TAO/tao/RTPortableServer/RT_Collocation_Resolver.i @@ -0,0 +1 @@ +// $Id$ diff --git a/TAO/tao/RTPortableServer/RT_Object_Adapter_Factory.cpp b/TAO/tao/RTPortableServer/RT_Object_Adapter_Factory.cpp index d89884ff202..bb57456cd56 100644 --- a/TAO/tao/RTPortableServer/RT_Object_Adapter_Factory.cpp +++ b/TAO/tao/RTPortableServer/RT_Object_Adapter_Factory.cpp @@ -5,6 +5,7 @@ #include "tao/ORB_Core.h" #include "RT_Servant_Dispatcher.h" #include "RT_Policy_Validator.h" +#include "RT_Collocation_Resolver.h" ACE_RCSID (TAO_RTPortableServer, RT_Object_Adapter_Factory, @@ -13,6 +14,9 @@ ACE_RCSID (TAO_RTPortableServer, TAO_RT_Object_Adapter_Factory::TAO_RT_Object_Adapter_Factory (void) { + // Set the name of the collocation resolver to be RT_Collocation_Resolver. + TAO_ORB_Core::set_collocation_resolver ("RT_Collocation_Resolver"); + ACE_Service_Config::process_directive (ace_svc_desc_TAO_RT_Collocation_Resolver); } TAO_Adapter* diff --git a/TAO/tao/RTPortableServer/TAO_RTPortableServer.dsp b/TAO/tao/RTPortableServer/TAO_RTPortableServer.dsp index c223aa17f50..c2a57e6fb9c 100644 --- a/TAO/tao/RTPortableServer/TAO_RTPortableServer.dsp +++ b/TAO/tao/RTPortableServer/TAO_RTPortableServer.dsp @@ -161,6 +161,10 @@ SOURCE=.\RT_Acceptor_Filters.cpp # End Source File
# Begin Source File
+SOURCE=.\RT_Collocation_Resolver.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\RT_Object_Adapter_Factory.cpp
# End Source File
# Begin Source File
@@ -193,6 +197,10 @@ SOURCE=.\RT_Acceptor_Filters.h # End Source File
# Begin Source File
+SOURCE=.\RT_Collocation_Resolver.h
+# End Source File
+# Begin Source File
+
SOURCE=.\RT_Object_Adapter_Factory.h
# End Source File
# Begin Source File
@@ -229,6 +237,10 @@ SOURCE=.\RT_Acceptor_Filters.i # End Source File
# Begin Source File
+SOURCE=.\RT_Collocation_Resolver.i
+# End Source File
+# Begin Source File
+
SOURCE=.\RT_POA.i
# End Source File
# Begin Source File
diff --git a/TAO/tao/TAO.dsp b/TAO/tao/TAO.dsp index e93ce65786a..cf7f6d26173 100644 --- a/TAO/tao/TAO.dsp +++ b/TAO/tao/TAO.dsp @@ -259,6 +259,10 @@ SOURCE=.\CodecFactory_ORBInitializer.cpp # End Source File
# Begin Source File
+SOURCE=.\Collocation_Resolver.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\Connection_Handler.cpp
# End Source File
# Begin Source File
@@ -303,6 +307,10 @@ SOURCE=.\default_client.cpp # End Source File
# Begin Source File
+SOURCE=.\Default_Collocation_Resolver.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\Default_Endpoint_Selector_Factory.cpp
# End Source File
# Begin Source File
@@ -896,7 +904,7 @@ SOURCE=.\WrongTransactionC.cpp # End Group
# Begin Group "Header Files"
-# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
+# PROP Default_Filter "h;hpp;hxx;hm;fi;fd"
# Begin Source File
SOURCE=.\Abstract_Servant_Base.h
@@ -979,10 +987,6 @@ SOURCE=.\Cleanup_Func_Registry.h # End Source File
# Begin Source File
-SOURCE=.\Cleanup_Func_Registry.inl
-# End Source File
-# Begin Source File
-
SOURCE=.\Client_Strategy_Factory.h
# End Source File
# Begin Source File
@@ -1003,6 +1007,10 @@ SOURCE=.\CodecFactory_ORBInitializer.h # End Source File
# Begin Source File
+SOURCE=.\Collocation_Resolver.h
+# End Source File
+# Begin Source File
+
SOURCE=.\Connection_Handler.h
# End Source File
# Begin Source File
@@ -1051,6 +1059,10 @@ SOURCE=.\default_client.h # End Source File
# Begin Source File
+SOURCE=.\Default_Collocation_Resolver.h
+# End Source File
+# Begin Source File
+
SOURCE=.\Default_Endpoint_Selector_Factory.h
# End Source File
# Begin Source File
@@ -1235,10 +1247,6 @@ SOURCE=.\Incoming_Message_Queue.h # End Source File
# Begin Source File
-SOURCE=.\Incoming_Message_Queue.inl
-# End Source File
-# Begin Source File
-
SOURCE=.\Interceptor_List.h
# End Source File
# Begin Source File
@@ -1283,66 +1291,34 @@ SOURCE=.\LF_Event.h # End Source File
# Begin Source File
-SOURCE=.\LF_Event.inl
-# End Source File
-# Begin Source File
-
SOURCE=.\LF_Event_Binder.h
# End Source File
# Begin Source File
-SOURCE=.\LF_Event_Binder.inl
-# End Source File
-# Begin Source File
-
SOURCE=.\LF_Event_Loop_Thread_Helper.h
# End Source File
# Begin Source File
-SOURCE=.\LF_Event_Loop_Thread_Helper.inl
-# End Source File
-# Begin Source File
-
SOURCE=.\LF_Follower.h
# End Source File
# Begin Source File
-SOURCE=.\LF_Follower.inl
-# End Source File
-# Begin Source File
-
SOURCE=.\LF_Follower_Auto_Adder.h
# End Source File
# Begin Source File
-SOURCE=.\LF_Follower_Auto_Adder.inl
-# End Source File
-# Begin Source File
-
SOURCE=.\LF_Follower_Auto_Ptr.h
# End Source File
# Begin Source File
-SOURCE=.\LF_Follower_Auto_Ptr.inl
-# End Source File
-# Begin Source File
-
SOURCE=.\LF_Strategy.h
# End Source File
# Begin Source File
-SOURCE=.\LF_Strategy.inl
-# End Source File
-# Begin Source File
-
SOURCE=.\LF_Strategy_Complete.h
# End Source File
# Begin Source File
-SOURCE=.\LF_Strategy_Complete.inl
-# End Source File
-# Begin Source File
-
SOURCE=.\Linear_Priority_Mapping.h
# End Source File
# Begin Source File
@@ -1519,10 +1495,6 @@ SOURCE=.\Queued_Message.h # End Source File
# Begin Source File
-SOURCE=.\Queued_Message.inl
-# End Source File
-# Begin Source File
-
SOURCE=.\Reactive_Flushing_Strategy.h
# End Source File
# Begin Source File
@@ -1551,10 +1523,6 @@ SOURCE=.\Resume_Handle.h # End Source File
# Begin Source File
-SOURCE=.\Resume_Handle.inl
-# End Source File
-# Begin Source File
-
SOURCE=.\sequence.h
# End Source File
# Begin Source File
@@ -1659,10 +1627,6 @@ SOURCE=.\Transport.h # End Source File
# Begin Source File
-SOURCE=.\Transport.inl
-# End Source File
-# Begin Source File
-
SOURCE=.\Transport_Cache_Manager.h
# End Source File
# Begin Source File
@@ -1728,7 +1692,7 @@ SOURCE=.\WrongTransactionC.h # End Group
# Begin Group "Inline Files"
-# PROP Default_Filter "i"
+# PROP Default_Filter "i;inl"
# Begin Source File
SOURCE=.\Acceptor_Filter.i
@@ -1779,10 +1743,18 @@ SOURCE=.\cdr.i # End Source File
# Begin Source File
+SOURCE=.\Cleanup_Func_Registry.inl
+# End Source File
+# Begin Source File
+
SOURCE=.\ClientInterceptorAdapter.inl
# End Source File
# Begin Source File
+SOURCE=.\Collocation_Resolver.i
+# End Source File
+# Begin Source File
+
SOURCE=.\Connection_Handler.i
# End Source File
# Begin Source File
@@ -1819,6 +1791,10 @@ SOURCE=.\default_client.i # End Source File
# Begin Source File
+SOURCE=.\Default_Collocation_Resolver.i
+# End Source File
+# Begin Source File
+
SOURCE=.\Default_Protocols_Hooks.i
# End Source File
# Begin Source File
@@ -1951,6 +1927,10 @@ SOURCE=.\IIOPC.i # End Source File
# Begin Source File
+SOURCE=.\Incoming_Message_Queue.inl
+# End Source File
+# Begin Source File
+
SOURCE=.\Interceptor_List.inl
# End Source File
# Begin Source File
@@ -1975,6 +1955,38 @@ SOURCE=.\Leader_Follower.i # End Source File
# Begin Source File
+SOURCE=.\LF_Event.inl
+# End Source File
+# Begin Source File
+
+SOURCE=.\LF_Event_Binder.inl
+# End Source File
+# Begin Source File
+
+SOURCE=.\LF_Event_Loop_Thread_Helper.inl
+# End Source File
+# Begin Source File
+
+SOURCE=.\LF_Follower.inl
+# End Source File
+# Begin Source File
+
+SOURCE=.\LF_Follower_Auto_Adder.inl
+# End Source File
+# Begin Source File
+
+SOURCE=.\LF_Follower_Auto_Ptr.inl
+# End Source File
+# Begin Source File
+
+SOURCE=.\LF_Strategy.inl
+# End Source File
+# Begin Source File
+
+SOURCE=.\LF_Strategy_Complete.inl
+# End Source File
+# Begin Source File
+
SOURCE=.\Linear_Priority_Mapping.i
# End Source File
# Begin Source File
@@ -2099,10 +2111,18 @@ SOURCE=.\Profile.i # End Source File
# Begin Source File
+SOURCE=.\Queued_Message.inl
+# End Source File
+# Begin Source File
+
SOURCE=.\Reply_Dispatcher.i
# End Source File
# Begin Source File
+SOURCE=.\Resume_Handle.inl
+# End Source File
+# Begin Source File
+
SOURCE=.\sequence.i
# End Source File
# Begin Source File
@@ -2171,6 +2191,10 @@ SOURCE=.\TimeBaseC.i # End Source File
# Begin Source File
+SOURCE=.\Transport.inl
+# End Source File
+# Begin Source File
+
SOURCE=.\Transport_Cache_Manager.inl
# End Source File
# Begin Source File
diff --git a/TAO/tao/TAO_Internal.cpp b/TAO/tao/TAO_Internal.cpp index 36cd01ffe94..edba8a0630b 100644 --- a/TAO/tao/TAO_Internal.cpp +++ b/TAO/tao/TAO_Internal.cpp @@ -25,6 +25,7 @@ #include "Default_Endpoint_Selector_Factory.h" #include "Default_Protocols_Hooks.h" #include "Default_Thread_Lane_Resources_Manager.h" +#include "Default_Collocation_Resolver.h" ACE_RCSID (tao, TAO_Internal, @@ -228,6 +229,8 @@ TAO_Internal::open_services_i (int &argc, insert (&ace_svc_desc_TAO_Default_Protocols_Hooks); ACE_Service_Config::static_svcs ()-> insert (&ace_svc_desc_TAO_Default_Thread_Lane_Resources_Manager_Factory); + ACE_Service_Config::static_svcs ()-> + insert (&ace_svc_desc_TAO_Default_Collocation_Resolver); int result = 0; diff --git a/TAO/tao/TAO_Static.dsp b/TAO/tao/TAO_Static.dsp index fa3e0ae5b44..875d1d7769b 100644 --- a/TAO/tao/TAO_Static.dsp +++ b/TAO/tao/TAO_Static.dsp @@ -259,6 +259,10 @@ SOURCE=.\Default_Thread_Lane_Resources_Manager.cpp # End Source File
# Begin Source File
+SOURCE=.\Default_Collocation_Resolver.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\DLL_ORB.cpp
# End Source File
# Begin Source File
@@ -759,6 +763,10 @@ SOURCE=.\Thread_Lane_Resources_Manager.cpp # End Source File
# Begin Source File
+SOURCE=.\Collocation_Resolver.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\TimeBaseC.cpp
# End Source File
# Begin Source File
@@ -1007,6 +1015,10 @@ SOURCE=.\Default_Thread_Lane_Resources_Manager.h # End Source File
# Begin Source File
+SOURCE=.\Default_Collocation_Resolver.h
+# End Source File
+# Begin Source File
+
SOURCE=.\Direct_Priority_Mapping.h
# End Source File
# Begin Source File
@@ -1579,6 +1591,10 @@ SOURCE=.\Thread_Lane_Resources_Manager.h # End Source File
# Begin Source File
+SOURCE=.\Collocation_Resolver.h
+# End Source File
+# Begin Source File
+
SOURCE=.\TimeBaseC.h
# End Source File
# Begin Source File
@@ -1767,6 +1783,10 @@ SOURCE=.\Default_Thread_Lane_Resources_Manager.i # End Source File
# Begin Source File
+SOURCE=.\Default_Collocation_Resolver.i
+# End Source File
+# Begin Source File
+
SOURCE=.\DLL_ORB.inl
# End Source File
# Begin Source File
@@ -2099,6 +2119,10 @@ SOURCE=.\Thread_Lane_Resources_Manager.i # End Source File
# Begin Source File
+SOURCE=.\Collocation_Resolver.i
+# End Source File
+# Begin Source File
+
SOURCE=.\TimeBaseC.i
# End Source File
# Begin Source File
diff --git a/TAO/tao/Thread_Lane_Resources_Manager.h b/TAO/tao/Thread_Lane_Resources_Manager.h index 66e125af9d3..4ede9f3ebc5 100644 --- a/TAO/tao/Thread_Lane_Resources_Manager.h +++ b/TAO/tao/Thread_Lane_Resources_Manager.h @@ -28,7 +28,7 @@ class TAO_LF_Strategy; /** * @class TAO_Thread_Lane_Resources_Manager * - * This class is a manager for thread resources. + * @brief This class is a manager for thread resources. * * \nosubgrouping * @@ -74,7 +74,7 @@ protected: /** * @class TAO_Thread_Lane_Resources_Manager_Factory * - * This class is a factory for managers of thread resources. + * @brief This class is a factory for managers of thread resources. * * \nosubgrouping * diff --git a/TAO/tao/default_Collocation_Resolver.i b/TAO/tao/default_Collocation_Resolver.i new file mode 100644 index 00000000000..cfa1da318d3 --- /dev/null +++ b/TAO/tao/default_Collocation_Resolver.i @@ -0,0 +1 @@ +// $Id$ diff --git a/TAO/tests/RTCORBA/Collocation/Collocation.cpp b/TAO/tests/RTCORBA/Collocation/Collocation.cpp new file mode 100644 index 00000000000..1d0eb3d26ad --- /dev/null +++ b/TAO/tests/RTCORBA/Collocation/Collocation.cpp @@ -0,0 +1,484 @@ +// $Id$ + +#include "ace/Get_Opt.h" +#include "ace/Array.h" +#include "testS.h" +#include "tao/RTPortableServer/RTPortableServer.h" + +ACE_RCSID(Collocations, Collocations, "$Id$") + +typedef ACE_Array<test_var> Tests; + +class test_i : + public POA_test, + public PortableServer::RefCountServantBase +{ +public: + test_i (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + Tests &tests); + + void start (CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void method (CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC ((CORBA::SystemException)); + + void shutdown (CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC ((CORBA::SystemException)); + + PortableServer::POA_ptr _default_POA (CORBA_Environment &ACE_TRY_ENV); + +private: + + CORBA::ORB_var orb_; + PortableServer::POA_var poa_; + Tests &tests_; +}; + +test_i::test_i (CORBA::ORB_ptr orb, + PortableServer::POA_ptr poa, + Tests &tests) + : orb_ (CORBA::ORB::_duplicate (orb)), + poa_ (PortableServer::POA::_duplicate (poa)), + tests_ (tests) +{ +} + +void +test_i::start (CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_DEBUG ((LM_DEBUG, + "test_i::start\n")); + + Tests::ITERATOR iterator (this->tests_); + while (!iterator.done ()) + { + test_var *test = 0; + iterator.next (test); + + (*test)->method (ACE_TRY_ENV); + ACE_CHECK; + + CORBA::String_var ior = + this->orb_->object_to_string (test->in (), + ACE_TRY_ENV); + ACE_CHECK; + + CORBA::Object_var object = + this->orb_->string_to_object (ior.in (), + ACE_TRY_ENV); + ACE_CHECK; + + test_var test_from_string = + test::_narrow (object.in (), + ACE_TRY_ENV); + ACE_CHECK; + + test_from_string->method (ACE_TRY_ENV); + ACE_CHECK; + + iterator.advance (); + } +} + +void +test_i::method (CORBA::Environment &) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_DEBUG ((LM_DEBUG, + "test_i::method\n")); +} + +void +test_i::shutdown (CORBA::Environment &ACE_TRY_ENV) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_DEBUG ((LM_DEBUG, + "test_i::shutdown\n")); + + this->orb_->shutdown (0, + ACE_TRY_ENV); + ACE_CHECK; +} + +PortableServer::POA_ptr +test_i::_default_POA (CORBA_Environment &) +{ + return PortableServer::POA::_duplicate (this->poa_.in ()); +} + +static CORBA::ULong stacksize = 0; +static CORBA::ULong static_threads = 1; +static CORBA::ULong dynamic_threads = 0; +static RTCORBA::Priority default_thread_priority; +static CORBA::Boolean allow_request_buffering = 0; +static CORBA::Boolean allow_borrowing = 0; +static CORBA::ULong max_buffered_requests = 0; +static CORBA::ULong max_request_buffer_size = 0; +static int iterations = 5; + +int +parse_args (int argc, char *argv[]) +{ + ACE_Get_Opt get_opts (argc, argv, "i:"); + int c; + + while ((c = get_opts ()) != -1) + switch (c) + { + case 'i': + iterations = ACE_OS::atoi (get_opts.optarg); + break; + + case '?': + default: + ACE_ERROR_RETURN ((LM_ERROR, + "usage: %s " + "-i <iterations> " + "\n", + argv [0]), + -1); + } + + return 0; +} + +void +create_servant_in_root_poa (Tests &tests, + CORBA::ORB_ptr orb, + PortableServer::POA_ptr root_poa, + CORBA::Environment &ACE_TRY_ENV) +{ + test_i *servant = 0; + ACE_NEW_THROW_EX (servant, + test_i (orb, + root_poa, + tests), + CORBA::NO_MEMORY ()); + ACE_CHECK; + + PortableServer::ServantBase_var safe_servant (servant); + + tests.size (tests.size () + 1); + tests[tests.size () - 1] = + servant->_this (ACE_TRY_ENV); + ACE_CHECK; +} + +void +create_poa_and_servant_with_tp_policy (Tests &tests, + CORBA::ORB_ptr orb, + RTCORBA::RTORB_ptr rt_orb, + PortableServer::POA_ptr root_poa, + PortableServer::POAManager_ptr poa_manager, + CORBA::Environment &ACE_TRY_ENV) +{ + RTCORBA::ThreadpoolId threadpool_id = + rt_orb->create_threadpool (stacksize, + static_threads, + dynamic_threads, + default_thread_priority, + allow_request_buffering, + max_buffered_requests, + max_request_buffer_size, + ACE_TRY_ENV); + ACE_CHECK; + + CORBA::Policy_var threadpool_policy = + rt_orb->create_threadpool_policy (threadpool_id, + ACE_TRY_ENV); + ACE_CHECK; + + CORBA::Policy_var implicit_activation_policy = + root_poa->create_implicit_activation_policy (PortableServer::IMPLICIT_ACTIVATION, + ACE_TRY_ENV); + ACE_CHECK; + + CORBA::PolicyList policies; + + policies.length (policies.length () + 1); + policies[policies.length () - 1] = + implicit_activation_policy; + + policies.length (policies.length () + 1); + policies[policies.length () - 1] = + threadpool_policy; + + PortableServer::POA_var poa = + root_poa->create_POA ("tp_child", + poa_manager, + policies, + ACE_TRY_ENV); + ACE_CHECK; + + test_i *servant = 0; + ACE_NEW_THROW_EX (servant, + test_i (orb, + poa.in (), + tests), + CORBA::NO_MEMORY ()); + ACE_CHECK; + + PortableServer::ServantBase_var safe_servant (servant); + + tests.size (tests.size () + 1); + tests[tests.size () - 1] = + servant->_this (ACE_TRY_ENV); + ACE_CHECK; +} + +void +create_poa_and_servant_with_tp_with_lanes_policy (Tests &tests, + CORBA::ORB_ptr orb, + RTCORBA::RTORB_ptr rt_orb, + PortableServer::POA_ptr root_poa, + PortableServer::POAManager_ptr poa_manager, + const char *poa_name, + RTCORBA::PriorityModel priority_model, + CORBA::Environment &ACE_TRY_ENV) +{ + RTCORBA::ThreadpoolLanes lanes (2); + lanes.length (2); + + lanes[0].lane_priority = default_thread_priority; + lanes[0].static_threads = static_threads; + lanes[0].dynamic_threads = dynamic_threads; + + lanes[1].lane_priority = default_thread_priority + 1; + lanes[1].static_threads = static_threads; + lanes[1].dynamic_threads = dynamic_threads; + + RTCORBA::ThreadpoolId threadpool_id = + rt_orb->create_threadpool_with_lanes (stacksize, + lanes, + allow_borrowing, + allow_request_buffering, + max_buffered_requests, + max_request_buffer_size, + ACE_TRY_ENV); + ACE_CHECK; + + CORBA::Policy_var threadpool_policy = + rt_orb->create_threadpool_policy (threadpool_id, + ACE_TRY_ENV); + ACE_CHECK; + + CORBA::Policy_var priority_model_policy = + rt_orb->create_priority_model_policy (priority_model, + 0, + ACE_TRY_ENV); + ACE_CHECK; + + CORBA::PolicyList policies; + + policies.length (policies.length () + 1); + policies[policies.length () - 1] = + threadpool_policy; + + policies.length (policies.length () + 1); + policies[policies.length () - 1] = + priority_model_policy; + + PortableServer::POA_var poa = + root_poa->create_POA (poa_name, + poa_manager, + policies, + ACE_TRY_ENV); + ACE_CHECK; + + RTPortableServer::POA_var rt_poa = + RTPortableServer::POA::_narrow (poa.in (), + ACE_TRY_ENV); + ACE_CHECK; + + test_i *servant1 = 0; + test_i *servant2 = 0; + ACE_NEW_THROW_EX (servant1, + test_i (orb, + poa.in (), + tests), + CORBA::NO_MEMORY ()); + ACE_CHECK; + + ACE_NEW_THROW_EX (servant2, + test_i (orb, + poa.in (), + tests), + CORBA::NO_MEMORY ()); + ACE_CHECK; + + PortableServer::ServantBase_var safe_servant1 (servant1); + PortableServer::ServantBase_var safe_servant2 (servant2); + + PortableServer::ObjectId_var id1; + PortableServer::ObjectId_var id2; + + if (priority_model == RTCORBA::SERVER_DECLARED) + { + id1 = + rt_poa->activate_object_with_priority (servant1, + default_thread_priority, + ACE_TRY_ENV); + ACE_CHECK; + + id2 = + rt_poa->activate_object_with_priority (servant2, + default_thread_priority + 1, + ACE_TRY_ENV); + ACE_CHECK; + } + else + { + id1 = + rt_poa->activate_object (servant1, + ACE_TRY_ENV); + ACE_CHECK; + + id2 = + rt_poa->activate_object (servant2, + ACE_TRY_ENV); + ACE_CHECK; + } + + CORBA::Object_var object1 = + poa->id_to_reference (id1.in (), + ACE_TRY_ENV); + ACE_CHECK; + + CORBA::Object_var object2 = + poa->id_to_reference (id2.in (), + ACE_TRY_ENV); + ACE_CHECK; + + tests.size (tests.size () + 1); + tests[tests.size () - 1] = + test::_narrow (object1.in (), + ACE_TRY_ENV); + ACE_CHECK; + + tests.size (tests.size () + 1); + tests[tests.size () - 1] = + test::_narrow (object2.in (), + ACE_TRY_ENV); + ACE_CHECK; +} + +int +main (int argc, char *argv[]) +{ + ACE_TRY_NEW_ENV + { + CORBA::ORB_var orb = + CORBA::ORB_init (argc, + argv, + "", + ACE_TRY_ENV); + ACE_TRY_CHECK; + + CORBA::Object_var object = + orb->resolve_initial_references ("RTORB", + ACE_TRY_ENV); + ACE_TRY_CHECK; + + RTCORBA::RTORB_var rt_orb = + RTCORBA::RTORB::_narrow (object.in (), + ACE_TRY_ENV); + ACE_TRY_CHECK; + + object = + orb->resolve_initial_references ("RTCurrent", + ACE_TRY_ENV); + ACE_TRY_CHECK; + + RTCORBA::Current_var current = + RTCORBA::Current::_narrow (object.in (), + ACE_TRY_ENV); + ACE_TRY_CHECK; + + default_thread_priority = + current->the_priority (ACE_TRY_ENV); + ACE_TRY_CHECK; + + object = + orb->resolve_initial_references ("RootPOA", + ACE_TRY_ENV); + ACE_TRY_CHECK; + + PortableServer::POA_var root_poa = + PortableServer::POA::_narrow (object.in (), + ACE_TRY_ENV); + ACE_TRY_CHECK; + + PortableServer::POAManager_var poa_manager = + root_poa->the_POAManager (ACE_TRY_ENV); + ACE_TRY_CHECK; + + poa_manager->activate (ACE_TRY_ENV); + ACE_TRY_CHECK; + + Tests tests; + + create_servant_in_root_poa (tests, + orb.in (), + root_poa.in (), + ACE_TRY_ENV); + ACE_TRY_CHECK; + + create_poa_and_servant_with_tp_policy (tests, + orb.in (), + rt_orb.in (), + root_poa.in (), + poa_manager.in (), + ACE_TRY_ENV); + ACE_TRY_CHECK; + + create_poa_and_servant_with_tp_with_lanes_policy (tests, + orb.in (), + rt_orb.in (), + root_poa.in (), + poa_manager.in (), + "tp_with_lanes_client_propagated_poa", + RTCORBA::CLIENT_PROPAGATED, + ACE_TRY_ENV); + ACE_TRY_CHECK; + + create_poa_and_servant_with_tp_with_lanes_policy (tests, + orb.in (), + rt_orb.in (), + root_poa.in (), + poa_manager.in (), + "tp_with_lanes_server_declared_poa", + RTCORBA::SERVER_DECLARED, + ACE_TRY_ENV); + ACE_TRY_CHECK; + + Tests::ITERATOR iterator (tests); + while (!iterator.done ()) + { + test_var *test = 0; + iterator.next (test); + + (*test)->start (ACE_TRY_ENV); + ACE_TRY_CHECK; + + iterator.advance (); + } + + orb->shutdown (1, ACE_TRY_ENV); + ACE_TRY_CHECK; + + orb->destroy (ACE_TRY_ENV); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Exception caught:"); + return 1; + } + ACE_ENDTRY; + + return 0; +} diff --git a/TAO/tests/RTCORBA/Collocation/Collocation.dsp b/TAO/tests/RTCORBA/Collocation/Collocation.dsp new file mode 100644 index 00000000000..9ef91c635b5 --- /dev/null +++ b/TAO/tests/RTCORBA/Collocation/Collocation.dsp @@ -0,0 +1,216 @@ +# Microsoft Developer Studio Project File - Name="Collocation" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=Collocation - Win32 Release
+!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 "Collocation.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 "Collocation.mak" CFG="Collocation - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "Collocation - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "Collocation - 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)" == "Collocation - 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_PortableServer.lib TAO_RTCORBA.lib TAO_RTPortableServer.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\..\ace" /libpath:"..\..\..\tao" /libpath:"..\..\..\tao\PortableServer" /libpath:"..\..\..\tao\RTCORBA" /libpath:"..\..\..\tao\RTPortableServer"
+
+!ELSEIF "$(CFG)" == "Collocation - 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 aced.lib TAOd.lib TAO_PortableServerd.lib TAO_RTCORBAd.lib TAO_RTPortableServerd.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\..\ace" /libpath:"..\..\..\tao" /libpath:"..\..\..\tao\PortableServer" /libpath:"..\..\..\tao\RTCORBA" /libpath:"..\..\..\tao\RTPortableServer"
+
+!ENDIF
+
+# Begin Target
+
+# Name "Collocation - Win32 Release"
+# Name "Collocation - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
+# Begin Source File
+
+SOURCE=.\Collocation.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\testC.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\testS.cpp
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl"
+# Begin Source File
+
+SOURCE=.\testC.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\testS.h
+# End Source File
+# End Group
+# Begin Group "Inline Files"
+
+# PROP Default_Filter "i"
+# Begin Source File
+
+SOURCE=.\testC.i
+# End Source File
+# Begin Source File
+
+SOURCE=.\testS.i
+# End Source File
+# End Group
+# Begin Group "IDL Files"
+
+# PROP Default_Filter "idl"
+# Begin Source File
+
+SOURCE=.\test.idl
+
+!IF "$(CFG)" == "Collocation - Win32 Release"
+
+USERDEP__TEST_="..\..\..\..\bin\Release\tao_idl.exe"
+# Begin Custom Build
+InputPath=.\test.idl
+InputName=test
+
+BuildCmds= \
+ ..\..\..\..\bin\Release\tao_idl.exe -Ge 1 $(InputName).idl
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ELSEIF "$(CFG)" == "Collocation - Win32 Debug"
+
+# PROP Ignore_Default_Tool 1
+USERDEP__TEST_="..\..\..\..\bin\tao_idl.exe"
+# Begin Custom Build - Invoking TAO_IDL on $(InputName)
+InputPath=.\test.idl
+InputName=test
+
+BuildCmds= \
+ ..\..\..\..\bin\tao_idl -Ge 1 $(InputName).idl
+
+"$(InputName)C.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)C.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.i" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+
+"$(InputName)S_T.cpp" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
+ $(BuildCmds)
+# End Custom Build
+
+!ENDIF
+
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/TAO/tests/RTCORBA/Collocation/Collocation.dsw b/TAO/tests/RTCORBA/Collocation/Collocation.dsw new file mode 100644 index 00000000000..52658fe3e58 --- /dev/null +++ b/TAO/tests/RTCORBA/Collocation/Collocation.dsw @@ -0,0 +1,29 @@ +Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "Collocation"=.\Collocation.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
diff --git a/TAO/tests/RTCORBA/Collocation/Makefile b/TAO/tests/RTCORBA/Collocation/Makefile new file mode 100644 index 00000000000..260b51fe953 --- /dev/null +++ b/TAO/tests/RTCORBA/Collocation/Makefile @@ -0,0 +1,56 @@ +#---------------------------------------------------------------------------- +# +# $Id$ +# +#---------------------------------------------------------------------------- + +#---------------------------------------------------------------------------- +# Local macros +#---------------------------------------------------------------------------- + +ifndef TAO_ROOT + TAO_ROOT = $(ACE_ROOT)/TAO +endif # ! TAO_ROOT + +IDL_FILES = test +IDL_SRC = testC.cpp testS.cpp +BIN_UNCHECKED = Collocation + +SRC = $(addsuffix .cpp, $(BIN)) $(IDL_SRC) + +COLLOCATION_OBJS = Collocation.o $(IDL_SRC:.cpp=.o) + +TAO_IDLFLAGS += -Ge 1 +#---------------------------------------------------------------------------- +# 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)) + +Collocation: $(addprefix $(VDIR),$(COLLOCATION_OBJS)) + $(LINK.cc) $(LDFLAGS) -o $@ $^ $(RT_TAO_SRVR_LIBS) $(POSTLINK) + +realclean: clean + -$(RM) $(foreach ext, $(IDL_EXT), test$(ext)) + +# DO NOT DELETE THIS LINE -- g++dep uses it. +# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY. + +# IF YOU PUT ANYTHING HERE IT WILL GO AWAY diff --git a/TAO/tests/RTCORBA/Collocation/Makefile.bor b/TAO/tests/RTCORBA/Collocation/Makefile.bor new file mode 100644 index 00000000000..e40de2f409d --- /dev/null +++ b/TAO/tests/RTCORBA/Collocation/Makefile.bor @@ -0,0 +1,38 @@ +NAME = Collocation + +TAO_IDL = $(CORE_BINDIR)\tao_idl -g $(CORE_BINDIR)\gperf.exe -Ge 1 + +OBJFILES = \ + $(OBJDIR)\testC.obj \ + $(OBJDIR)\testS.obj \ + $(OBJDIR)\Collocation.obj + +CFLAGS = \ + $(ACE_CFLAGS) \ + $(TAO_CFLAGS) \ + $(TAO_PORTABLESERVER_CFLAGS) \ + $(TAO_RTCORBA_CFLAGS) \ + $(TAO_RTPORTABLESERVER_CFLAGS) + +LIBFILES = \ + $(ACE_LIB) \ + $(TAO_LIB) \ + $(TAO_PORTABLESERVER_LIB) \ + $(TAO_RTCORBA_LIB) \ + $(TAO_RTPORTABLESERVER_LIB) + +IDLFILES = \ + $(IDLDIR)\test.idl + +CPPDIR = . + +IDLDIR = . + +!include <$(ACE_ROOT)\include\makeinclude\build_exe.bor> + +# +# IDL Build rules +# + +$(IDLDIR)\testS.cpp $(IDLDIR)\testC.cpp: $(IDLDIR)\test.idl + $(TAO_IDL) $** diff --git a/TAO/tests/RTCORBA/Collocation/README b/TAO/tests/RTCORBA/Collocation/README new file mode 100644 index 00000000000..8a1ee7f02b9 --- /dev/null +++ b/TAO/tests/RTCORBA/Collocation/README @@ -0,0 +1,5 @@ +$Id$ + +Description: +This is a simple test for collocation. + diff --git a/TAO/tests/RTCORBA/Collocation/run_test.pl b/TAO/tests/RTCORBA/Collocation/run_test.pl new file mode 100755 index 00000000000..970fbc9d2f3 --- /dev/null +++ b/TAO/tests/RTCORBA/Collocation/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 Collocation Unit Test **********\n\n"; + +$T = new PerlACE::Process ("Collocation"); + +$test = $T->SpawnWaitKill (60); + +if ($test != 0) { + print STDERR "ERROR: test returned $test\n"; + exit 1; +} + +exit 0; diff --git a/TAO/tests/RTCORBA/Collocation/test.idl b/TAO/tests/RTCORBA/Collocation/test.idl new file mode 100644 index 00000000000..61a9662678b --- /dev/null +++ b/TAO/tests/RTCORBA/Collocation/test.idl @@ -0,0 +1,10 @@ +// $Id$ + +interface test +{ + void start (); + + void method (); + + void shutdown (); +}; diff --git a/TAO/tests/RTCORBA/Policy_Combinations/server.cpp b/TAO/tests/RTCORBA/Policy_Combinations/server.cpp index ae1863d5c62..43354cc3d1b 100644 --- a/TAO/tests/RTCORBA/Policy_Combinations/server.cpp +++ b/TAO/tests/RTCORBA/Policy_Combinations/server.cpp @@ -100,8 +100,8 @@ test_i::_default_POA (CORBA_Environment &) return PortableServer::POA::_duplicate (this->poa_.in ()); } -static CORBA::Short server_priority = 15; -static CORBA::Short client_priority = 2; +static CORBA::Short server_priority; +static CORBA::Short client_priority; static CORBA::ULong stacksize = 0; static CORBA::ULong static_threads = 2; static CORBA::ULong dynamic_threads = 2; @@ -372,7 +372,7 @@ server::test_bands_poa (CORBA::PolicyList &policies, bands[0].high = default_thread_priority; bands[1].low = ::server_priority; bands[1].high = ::server_priority; - bands[2].low = ::client_priority - 1; + bands[2].low = ::client_priority; bands[2].high = ::client_priority; policies.length (policies.length () + 1); @@ -604,7 +604,7 @@ void server::test_lanes_bands_client_propagated_poa (CORBA::Environment &ACE_TRY_ENV) { this->test_lanes_poa (::client_priority, - ::client_priority - 1, + ::client_priority, &server::test_bands_client_propagated_poa, "lanes_bands_client_propagated", ACE_TRY_ENV); @@ -789,6 +789,12 @@ main (int argc, char **argv) current->the_priority (ACE_TRY_ENV); ACE_TRY_CHECK; + client_priority = + default_thread_priority + 1; + + server_priority = + default_thread_priority + 2; + int result = parse_args (argc, argv); if (result != 0) |