diff options
author | Angelo Corsaro <angelo@icorsaro.net> | 2000-11-20 02:15:14 +0000 |
---|---|---|
committer | Angelo Corsaro <angelo@icorsaro.net> | 2000-11-20 02:15:14 +0000 |
commit | b3b56f54df7a000e6f1e25ed2ea883e4bc188082 (patch) | |
tree | 64b1735a58a2ee391bc3bc321e87ce392a976d56 /TAO/tao | |
parent | 0e01dd982d864bd24dc9a8f7d9186465ca9b307f (diff) | |
download | ATCD-b3b56f54df7a000e6f1e25ed2ea883e4bc188082.tar.gz |
ChangeLogTag: Sun Nov 19 19:11:19 2000 Angelo Corsaro <corsaro@cs.wustl.edu>
Diffstat (limited to 'TAO/tao')
-rw-r--r-- | TAO/tao/MessagingC.cpp | 134 | ||||
-rw-r--r-- | TAO/tao/MessagingC.h | 125 | ||||
-rw-r--r-- | TAO/tao/MessagingC.i | 22 | ||||
-rw-r--r-- | TAO/tao/PortableServer/MessagingS.cpp | 320 | ||||
-rw-r--r-- | TAO/tao/PortableServer/MessagingS.h | 125 | ||||
-rw-r--r-- | TAO/tao/corba.h | 1 |
6 files changed, 467 insertions, 260 deletions
diff --git a/TAO/tao/MessagingC.cpp b/TAO/tao/MessagingC.cpp index a9a900af377..c339d08ee17 100644 --- a/TAO/tao/MessagingC.cpp +++ b/TAO/tao/MessagingC.cpp @@ -1571,6 +1571,83 @@ Messaging::ExceptionHolder_init::tao_repository_id () #endif /* end #if !defined */ + +/////////////////////////////////////////////////////////////////////// +// Base & Remote Proxy Implementation. +// + +Messaging::_TAO_ReplyHandler_Proxy_Impl::~_TAO_ReplyHandler_Proxy_Impl (void) +{} + +Messaging::_TAO_ReplyHandler_Remote_Proxy_Impl::~_TAO_ReplyHandler_Remote_Proxy_Impl (void) +{} + +// +// End Base & Remote Proxy Implemeentation. +/////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////// +// Remote & Base Proxy Broker Implementation +// + +Messaging::_TAO_ReplyHandler_Proxy_Broker::~_TAO_ReplyHandler_Proxy_Broker (void) +{ +} + +// Factory function Implementation. +Messaging::_TAO_ReplyHandler_Remote_Proxy_Broker *Messaging::the_TAO_ReplyHandler_Remote_Proxy_Broker (void) +{ + static ::Messaging::_TAO_ReplyHandler_Remote_Proxy_Broker remote_proxy_broker; + return &remote_proxy_broker; +} + +Messaging::_TAO_ReplyHandler_Remote_Proxy_Broker::~_TAO_ReplyHandler_Remote_Proxy_Broker (void) +{ +} + +Messaging::_TAO_ReplyHandler_Proxy_Impl& +Messaging::_TAO_ReplyHandler_Remote_Proxy_Broker::select_proxy ( + + ::Messaging::ReplyHandler *object, + CORBA::Environment &ACE_TRY_ENV + ) +{ + ACE_UNUSED_ARG (object); + ACE_UNUSED_ARG (ACE_TRY_ENV); + return remote_proxy_impl_; +} + + +// +// End Remote & Base Proxy Broker Implementation +/////////////////////////////////////////////////////////////////////// + + +// default constructor +Messaging::ReplyHandler::ReplyHandler (int collocated) +{ + this->setup_collocation (collocated); +} + +// destructor +Messaging::ReplyHandler::~ReplyHandler (void) +{} + +void +Messaging::ReplyHandler::setup_collocation (int collocated) +{ + if (collocated) + this->the_TAO_ReplyHandler_Proxy_Broker_ = + Messaging__TAO_ReplyHandler_Proxy_Broker_Factory_function_pointer (this); + else + this->the_TAO_ReplyHandler_Proxy_Broker_ = + ::Messaging::the_TAO_ReplyHandler_Remote_Proxy_Broker (); + + +} + + void Messaging::ReplyHandler::_tao_any_destructor (void *x) { ReplyHandler *tmp = ACE_static_cast (ReplyHandler*,x); @@ -1608,34 +1685,42 @@ Messaging::ReplyHandler_ptr Messaging::ReplyHandler::_unchecked_narrow ( stub->_incr_refcnt (); ReplyHandler_ptr default_proxy = ReplyHandler::_nil (); - if (obj->_is_collocated () && _TAO_collocation_Messaging_ReplyHandler_Stub_Factory_function_pointer != 0) - { - default_proxy = _TAO_collocation_Messaging_ReplyHandler_Stub_Factory_function_pointer (obj); + if ( + !CORBA::is_nil (stub->servant_orb_var ().ptr ()) && + stub->servant_orb_var ()->orb_core ()->optimize_collocation_objects () && + obj->_is_collocated () &&Messaging__TAO_ReplyHandler_Proxy_Broker_Factory_function_pointer != 0 + ) + { + ACE_NEW_RETURN ( + default_proxy, + ::Messaging::ReplyHandler ( + stub, + 1, + obj->_servant ()), + + ReplyHandler::_nil ()); } if (CORBA::is_nil (default_proxy)) - ACE_NEW_RETURN (default_proxy, ReplyHandler (stub), ReplyHandler::_nil ()); - #if (TAO_HAS_SMART_PROXIES == 1) + ACE_NEW_RETURN (default_proxy, ::Messaging::ReplyHandler (stub, 0, obj->_servant ()), ReplyHandler::_nil ()); return TAO_Messaging_ReplyHandler_PROXY_FACTORY_ADAPTER::instance ()->create_proxy (default_proxy); - #else - return default_proxy; - #endif /*TAO_HAS_SMART_PROXIES == 1*/ - } - else - return - ACE_reinterpret_cast - ( - ReplyHandler_ptr, - obj->_tao_QueryInterface - ( - ACE_reinterpret_cast - ( - ptr_arith_t, - &ReplyHandler::_narrow - ) - ) - ); + } + else + return + ACE_reinterpret_cast + ( + ReplyHandler_ptr, + obj->_tao_QueryInterface + ( + ACE_reinterpret_cast + ( + ptr_arith_t, + &ReplyHandler::_narrow + ) + ) + ); } + Messaging::ReplyHandler_ptr Messaging::ReplyHandler::_duplicate (ReplyHandler_ptr obj) { @@ -2255,9 +2340,10 @@ CORBA::Boolean operator>>= (const CORBA::Any &_tao_any, const Messaging::PolicyV #if (TAO_HAS_AMI_CALLBACK == 1) || (TAO_HAS_AMI_POLLER == 1) - Messaging::ReplyHandler_ptr (*_TAO_collocation_Messaging_ReplyHandler_Stub_Factory_function_pointer) ( + Messaging::_TAO_ReplyHandler_Proxy_Broker * (*Messaging__TAO_ReplyHandler_Proxy_Broker_Factory_function_pointer) ( CORBA::Object_ptr obj ) = 0; + void operator<<= (CORBA::Any &_tao_any, Messaging::ReplyHandler_ptr _tao_elem) { TAO_OutputCDR stream; diff --git a/TAO/tao/MessagingC.h b/TAO/tao/MessagingC.h index 24df0cbb898..d04e5356103 100644 --- a/TAO/tao/MessagingC.h +++ b/TAO/tao/MessagingC.h @@ -12,6 +12,7 @@ #include "ace/pre.h" #include "tao/orbconf.h" +#include "Remote_Object_Proxy_Impl.h" #if (TAO_HAS_CORBA_MESSAGING == 1) @@ -2515,6 +2516,12 @@ class TAO_Export QueueOrderPolicy: public virtual CORBA::Policy #if !defined (_MESSAGING_REPLYHANDLER_CH_) #define _MESSAGING_REPLYHANDLER_CH_ +// Forward Classes Declaration +class _TAO_ReplyHandler_Proxy_Impl; +class _TAO_ReplyHandler_Remote_Proxy_Impl; +class _TAO_ReplyHandler_Proxy_Broker; +class _TAO_ReplyHandler_Remote_Proxy_Broker; + class TAO_Export ReplyHandler : public virtual CORBA_Object { public: @@ -2551,17 +2558,120 @@ class TAO_Export ReplyHandler : public virtual CORBA_Object virtual const char* _interface_repository_id (void) const; + private: + _TAO_ReplyHandler_Proxy_Broker *the_TAO_ReplyHandler_Proxy_Broker_; + protected: - ReplyHandler (void); - ReplyHandler (TAO_Stub *objref, - CORBA::Boolean _tao_collocated = 0 - ); + ReplyHandler (int collocated = 0); + + protected: + virtual void setup_collocation (int collocated); + + ReplyHandler ( + TAO_Stub *objref, + CORBA::Boolean _tao_collocated = 0, + TAO_Abstract_ServantBase *servant = 0 + ); + + friend class _TAO_ReplyHandler_Remote_Proxy_Impl; + friend class _TAO_ReplyHandler_ThruPOA_Proxy_Impl; + friend class _TAO_ReplyHandler_Direct_Proxy_Impl; + virtual ~ReplyHandler (void); private: ReplyHandler (const ReplyHandler &); void operator= (const ReplyHandler &); }; + + // The Proxy Implementations are used by each interface to + // perform a call. Each different implementation encapsulate + // an invocation logics. + + + /////////////////////////////////////////////////////////////////////// + // Base Impl. Declaration + // + + class TAO_Export _TAO_ReplyHandler_Proxy_Impl : public virtual TAO_Object_Proxy_Impl + { + public: + virtual ~_TAO_ReplyHandler_Proxy_Impl (void); + + }; + + // + // Base Proxy Impl. Declaration + /////////////////////////////////////////////////////////////////////// + + + /////////////////////////////////////////////////////////////////////// + // Remote Impl. Declaration + // + + class TAO_Export _TAO_ReplyHandler_Remote_Proxy_Impl : + public virtual _TAO_ReplyHandler_Proxy_Impl, + public virtual TAO_Remote_Object_Proxy_Impl + { + public: + virtual ~_TAO_ReplyHandler_Remote_Proxy_Impl (void); + + }; + + // + // Base Proxy Impl. Declaration + /////////////////////////////////////////////////////////////////////// + + /////////////////////////////////////////////////////////////////////// + // Base Proxy Broker Declaration + // + + class TAO_Export _TAO_ReplyHandler_Proxy_Broker + { + public: + virtual ~_TAO_ReplyHandler_Proxy_Broker (void); + + virtual _TAO_ReplyHandler_Proxy_Impl &select_proxy ( + ReplyHandler *object, + CORBA_Environment &ACE_TRY_ENV = TAO_default_environment () + ) = 0; + + }; + + + // + // End Base Proxy Broker Declaration + /////////////////////////////////////////////////////////////////////// + + + /////////////////////////////////////////////////////////////////////// + // Remote Proxy Broker Declaration + // + + class TAO_Export _TAO_ReplyHandler_Remote_Proxy_Broker : public virtual _TAO_ReplyHandler_Proxy_Broker + { + public: + virtual ~_TAO_ReplyHandler_Remote_Proxy_Broker (void); + + virtual _TAO_ReplyHandler_Proxy_Impl &select_proxy ( + ReplyHandler *object, + CORBA_Environment &ACE_TRY_ENV = TAO_default_environment () + ); + + private: + _TAO_ReplyHandler_Remote_Proxy_Impl remote_proxy_impl_; + }; + + // This funxtion is used to get an handle to the unique instance + // of the Remote Proxy Broker that is available for a given + // interface. + + _TAO_ReplyHandler_Remote_Proxy_Broker *the_TAO_ReplyHandler_Remote_Proxy_Broker (void); + + // + // End Remote Proxy Broker Declaration + /////////////////////////////////////////////////////////////////////// + #if (TAO_HAS_SMART_PROXIES == 1) class TAO_Export TAO_Messaging_ReplyHandler_Default_Proxy_Factory { @@ -2576,7 +2686,8 @@ class TAO_Export TAO_Messaging_ReplyHandler_Default_Proxy_Factory CORBA::Environment &ACE_TRY_ENV = TAO_default_environment () ); - }; +}; + class TAO_Export TAO_Messaging_ReplyHandler_Proxy_Factory_Adapter { @@ -2744,6 +2855,10 @@ TAO_Export CORBA::Boolean operator>>= (const CORBA::Any &, const Messaging::Poli #if (TAO_HAS_AMI_CALLBACK == 1) +extern TAO_Export Messaging::_TAO_ReplyHandler_Proxy_Broker * (*Messaging__TAO_ReplyHandler_Proxy_Broker_Factory_function_pointer) ( + CORBA::Object_ptr obj + ); + extern TAO_Export Messaging::ReplyHandler_ptr (*_TAO_collocation_Messaging_ReplyHandler_Stub_Factory_function_pointer) ( CORBA::Object_ptr obj ); diff --git a/TAO/tao/MessagingC.i b/TAO/tao/MessagingC.i index 1c4b33e33a6..1e205275950 100644 --- a/TAO/tao/MessagingC.i +++ b/TAO/tao/MessagingC.i @@ -3853,18 +3853,16 @@ Messaging::ExceptionHolder::_tao_seq_Octet_out::operator[] (CORBA::ULong index) #endif /* end #if !defined */ ACE_INLINE -Messaging::ReplyHandler::ReplyHandler (void) // default constructor -{} - -ACE_INLINE -Messaging::ReplyHandler::ReplyHandler (TAO_Stub *objref, CORBA::Boolean _tao_collocated) // constructor - : CORBA_Object (objref, _tao_collocated) -{} - -ACE_INLINE -Messaging::ReplyHandler::~ReplyHandler (void) // destructor -{} - +Messaging::ReplyHandler::ReplyHandler ( + TAO_Stub *objref, + CORBA::Boolean _tao_collocated, + TAO_Abstract_ServantBase *servant + ) + : CORBA_Object (objref, _tao_collocated, servant) + { + + this->setup_collocation (_tao_collocated); + } #if !defined (_MESSAGING_REPLYHANDLER___VAR_CI_) #define _MESSAGING_REPLYHANDLER___VAR_CI_ diff --git a/TAO/tao/PortableServer/MessagingS.cpp b/TAO/tao/PortableServer/MessagingS.cpp index 929118842f5..2a5bf27d15d 100644 --- a/TAO/tao/PortableServer/MessagingS.cpp +++ b/TAO/tao/PortableServer/MessagingS.cpp @@ -126,61 +126,153 @@ TAO_Messaging_ReplyHandler_Perfect_Hash_OpTable::lookup (const char *str, unsign /* ending time is 12:21:06 */ static TAO_Messaging_ReplyHandler_Perfect_Hash_OpTable tao_Messaging_ReplyHandler_optable; -Messaging::ReplyHandler_ptr _TAO_collocation_POA_Messaging_ReplyHandler_Stub_Factory ( - CORBA::Object_ptr obj +/////////////////////////////////////////////////////////////////////// +// Strategized Proxy Broker Implementation +// + +// Factory function Implementation. +POA_Messaging::_TAO_ReplyHandler_Strategized_Proxy_Broker *POA_Messaging::the_TAO_ReplyHandler_Strategized_Proxy_Broker (void) +{ + static POA_Messaging::_TAO_ReplyHandler_Strategized_Proxy_Broker strategized_proxy_broker; + return &strategized_proxy_broker; +} + +POA_Messaging::_TAO_ReplyHandler_Strategized_Proxy_Broker::_TAO_ReplyHandler_Strategized_Proxy_Broker (void) +{ + for (int i = 0; i < TAO_ORB_Core::COLLOCATION_STRATEGIES_NUM; ++i) + this->proxy_cache_[i] = 0; + +} + +POA_Messaging::_TAO_ReplyHandler_Strategized_Proxy_Broker::~_TAO_ReplyHandler_Strategized_Proxy_Broker (void) +{ + for (int i = 0; i < TAO_ORB_Core::COLLOCATION_STRATEGIES_NUM; ++i) + delete this->proxy_cache_[i]; + +} + +Messaging::_TAO_ReplyHandler_Proxy_Impl& +POA_Messaging::_TAO_ReplyHandler_Strategized_Proxy_Broker::select_proxy ( + ::Messaging::ReplyHandler *object, + CORBA::Environment &ACE_TRY_ENV ) { - TAO_Stub *stub = obj->_stubobj (); + TAO_ORB_Core::TAO_Collocation_Strategies strategy = + TAO_ORB_Core::collocation_strategy (object); + + if (this->proxy_cache_[strategy] != 0) + return *this->proxy_cache_[strategy]; + + this->create_proxy (strategy, ACE_TRY_ENV); + ACE_CHECK_RETURN (*this->proxy_cache_[strategy]); + + return *this->proxy_cache_[strategy]; + +} - switch (stub->servant_orb_var ()->orb_core ()->get_collocation_strategy ()) +void +POA_Messaging::_TAO_ReplyHandler_Strategized_Proxy_Broker::create_proxy ( + TAO_ORB_Core::TAO_Collocation_Strategies strategy, + CORBA::Environment &ACE_TRY_ENV + ) +{ + ACE_GUARD (ACE_SYNCH_MUTEX, guard, this->mutex_); + + if (this->proxy_cache_[strategy] == 0) { - case TAO_ORB_Core::THRU_POA: - { - Messaging::ReplyHandler_ptr retval = 0; - ACE_NEW_RETURN ( - retval, - POA_Messaging::_tao_thru_poa_collocated_ReplyHandler (stub), - 0 - ); - return retval; - } - case TAO_ORB_Core::DIRECT: - if (obj->_is_local () != 0) + switch (strategy) { - TAO_Collocated_Object *local_object = - TAO_Collocated_Object::_narrow (obj); - - POA_Messaging::ReplyHandler *servant = ACE_reinterpret_cast (POA_Messaging::ReplyHandler*, local_object->_servant ()->_downcast ("IDL:omg.org/Messaging/ReplyHandler:1.0")); - if (servant != 0) - { - Messaging::ReplyHandler *retval = 0; - ACE_NEW_RETURN ( - retval, - POA_Messaging::_tao_direct_collocated_ReplyHandler (servant, stub), - 0 - ); - return retval; - } - } - break; - default: - break; - } - return 0; + case TAO_ORB_Core::THRU_POA_STRATEGY: + ACE_NEW_THROW_EX ( + this->proxy_cache_[strategy], + POA_Messaging::_TAO_ReplyHandler_ThruPOA_Proxy_Impl, + CORBA::NO_MEMORY () + ); + ACE_CHECK; + break; + + case TAO_ORB_Core::DIRECT_STRATEGY: + ACE_NEW_THROW_EX ( + this->proxy_cache_[strategy], + POA_Messaging::_TAO_ReplyHandler_Direct_Proxy_Impl, + CORBA::NO_MEMORY () + ); + ACE_CHECK; + break; + + case TAO_ORB_Core::REMOTE_STRATEGY: + default: + ACE_NEW_THROW_EX ( + this->proxy_cache_[strategy], + ::Messaging::_TAO_ReplyHandler_Remote_Proxy_Impl, + CORBA::NO_MEMORY () + ); + ACE_CHECK; + break; + + } + + } } -int _TAO_collocation_POA_Messaging_ReplyHandler_Stub_Factory_Initializer (long dummy) -{ - ACE_UNUSED_ARG (dummy); - _TAO_collocation_Messaging_ReplyHandler_Stub_Factory_function_pointer = - _TAO_collocation_POA_Messaging_ReplyHandler_Stub_Factory; +// +// End Strategized Proxy Broker Implementation +/////////////////////////////////////////////////////////////////////// + +Messaging::_TAO_ReplyHandler_Proxy_Broker * +Messaging__TAO_ReplyHandler_Proxy_Broker_Factory_function (CORBA::Object_ptr obj) +{ + ACE_UNUSED_ARG (obj); + return POA_Messaging::the_TAO_ReplyHandler_Strategized_Proxy_Broker(); +} + +int +Messaging__TAO_ReplyHandler_Proxy_Broker_Factory_Initializer (long _dummy_) +{ + ACE_UNUSED_ARG (_dummy_); + + Messaging__TAO_ReplyHandler_Proxy_Broker_Factory_function_pointer = + Messaging__TAO_ReplyHandler_Proxy_Broker_Factory_function; + return 0; } -static int _TAO_collocation_POA_Messaging_ReplyHandler_Stub_Factory_Initializer_Scarecrow = - _TAO_collocation_POA_Messaging_ReplyHandler_Stub_Factory_Initializer (ACE_reinterpret_cast (long, _TAO_collocation_POA_Messaging_ReplyHandler_Stub_Factory_Initializer)); +static int Messaging__TAO_ReplyHandler_Proxy_Broker_Stub_Factory_Initializer_Scarecrow = + Messaging__TAO_ReplyHandler_Proxy_Broker_Factory_Initializer (ACE_reinterpret_cast (long, Messaging__TAO_ReplyHandler_Proxy_Broker_Factory_Initializer)); + + + + + +/////////////////////////////////////////////////////////////////////// +// ThruPOA Proxy Implementation +// + +POA_Messaging::_TAO_ReplyHandler_ThruPOA_Proxy_Impl::~_TAO_ReplyHandler_ThruPOA_Proxy_Impl (void) +{} + +// ThruPOA Implementation of the IDL interface methods + + +// +// End ThruPOA Proxy Implementation +/////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////// +// Direct Proxy Implementation +// + +POA_Messaging::_TAO_ReplyHandler_Direct_Proxy_Impl::~_TAO_ReplyHandler_Direct_Proxy_Impl (void) +{} + + +// +// End Direct Proxy Implementation +/////////////////////////////////////////////////////////////////////// + // skeleton constructor POA_Messaging::ReplyHandler::ReplyHandler (void) @@ -272,148 +364,26 @@ const char* POA_Messaging::ReplyHandler::_interface_repository_id (void) const return "IDL:omg.org/Messaging/ReplyHandler:1.0"; } + + Messaging::ReplyHandler* POA_Messaging::ReplyHandler::_this (CORBA_Environment &ACE_TRY_ENV) { TAO_Stub *stub = this->_create_stub (ACE_TRY_ENV); ACE_CHECK_RETURN (0); + + CORBA::Object_ptr tmp = CORBA::Object::_nil (); + if (stub->servant_orb_var ()->orb_core ()->optimize_collocation_objects ()) - switch (stub->servant_orb_var ()->orb_core ()->get_collocation_strategy ()) - { - case TAO_ORB_Core::THRU_POA: - { - ::Messaging::ReplyHandler_ptr retval = 0; - ACE_NEW_RETURN ( - retval, - POA_Messaging::_tao_thru_poa_collocated_ReplyHandler (stub), - 0 - ); - return retval; - } - case TAO_ORB_Core::DIRECT: - { - ::Messaging::ReplyHandler_ptr retval = 0; - ACE_NEW_RETURN ( - retval, - POA_Messaging::_tao_direct_collocated_ReplyHandler (this, stub), - 0 - ); - return retval; - } - default: - ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0); - } + ACE_NEW_RETURN (tmp, CORBA::Object (stub, 1, this), 0); else - { - // stub->_incr_refcnt (); - CORBA::Object_ptr tmp = CORBA::Object::_nil (); - ACE_NEW_RETURN (tmp, CORBA::Object (stub), 0); - CORBA::Object_var obj = tmp; - return ::Messaging::ReplyHandler::_unchecked_narrow (obj.in ()); - } -} - -POA_Messaging::_tao_thru_poa_collocated_ReplyHandler::_tao_thru_poa_collocated_ReplyHandler ( - TAO_Stub *stub -) - : CORBA_Object (stub, 1) -{ -} - -CORBA::Boolean POA_Messaging::_tao_thru_poa_collocated_ReplyHandler::_is_a( - const CORBA::Char *logical_type_id, - CORBA_Environment &ACE_TRY_ENV - ) - -{ - TAO_Object_Adapter::Servant_Upcall servant_upcall ( - this->_stubobj ()->servant_orb_var ()->orb_core () - ); - CORBA::Object_var forward_to; - servant_upcall.prepare_for_upcall ( - this->_object_key (), - "_is_a", - forward_to.out (), - ACE_TRY_ENV - ); - ACE_CHECK_RETURN (0); - return ACE_reinterpret_cast ( - POA_Messaging::ReplyHandler_ptr, - servant_upcall.servant ()->_downcast ( - "IDL:omg.org/Messaging/ReplyHandler:1.0" - ) - )->_is_a (logical_type_id, ACE_TRY_ENV); + ACE_NEW_RETURN (tmp, CORBA::Object (stub, 0, this), 0); + + CORBA::Object_var obj = tmp; + return ::Messaging::ReplyHandler::_unchecked_narrow (obj.in ()); } -CORBA::Boolean POA_Messaging::_tao_thru_poa_collocated_ReplyHandler::_non_existent( - CORBA_Environment &ACE_TRY_ENV - ) - -{ - TAO_Object_Adapter::Servant_Upcall servant_upcall ( - this->_stubobj ()->servant_orb_var ()->orb_core () - ); - CORBA::Object_var forward_to; - servant_upcall.prepare_for_upcall ( - this->_object_key (), - "_non_existent", - forward_to.out (), - ACE_TRY_ENV - ); - ACE_CHECK_RETURN (0); - return ACE_reinterpret_cast ( - POA_Messaging::ReplyHandler_ptr, - servant_upcall.servant ()->_downcast ( - "IDL:omg.org/Messaging/ReplyHandler:1.0" - ) - )->_non_existent (ACE_TRY_ENV); -} - - -POA_Messaging::_tao_direct_collocated_ReplyHandler::_tao_direct_collocated_ReplyHandler ( - POA_Messaging::ReplyHandler_ptr servant, - TAO_Stub *stub - ) - : ACE_NESTED_CLASS (Messaging,ReplyHandler) (), - TAO_Collocated_Object (stub, 1, servant), - CORBA_Object (stub, 1), - servant_ (servant) -{ -} - -CORBA::Boolean POA_Messaging::_tao_direct_collocated_ReplyHandler::_is_a( - const CORBA::Char *logical_type_id, - CORBA_Environment &ACE_TRY_ENV - ) - -{ - return this->servant_->_is_a (logical_type_id, ACE_TRY_ENV); -} - -void * -POA_Messaging::_tao_direct_collocated_ReplyHandler::_tao_QueryInterface (ptr_arith_t type) -{ - void *value = - this->TAO_Collocated_Object::_tao_QueryInterface (type); - if (value != 0) - return value; - return this->ACE_NESTED_CLASS (Messaging, ReplyHandler)::_tao_QueryInterface (type); -} - - -POA_Messaging::ReplyHandler_ptr POA_Messaging::_tao_direct_collocated_ReplyHandler::_get_servant (void) const -{ - return this->servant_; -} - -CORBA::Boolean POA_Messaging::_tao_direct_collocated_ReplyHandler::_non_existent( - CORBA_Environment &ACE_TRY_ENV - ) - -{ - return this->servant_->_non_existent (ACE_TRY_ENV); -} #endif /* TAO_HAS_AMI_CALLBACK == 1 || TAO_HAS_AMI_POLLER == 1 */ diff --git a/TAO/tao/PortableServer/MessagingS.h b/TAO/tao/PortableServer/MessagingS.h index 8fdb4fccd4f..6a417dafebe 100644 --- a/TAO/tao/PortableServer/MessagingS.h +++ b/TAO/tao/PortableServer/MessagingS.h @@ -11,8 +11,8 @@ #define _TAO_IDL_ORIG_MESSAGINGS_H_ #include "ace/pre.h" - #include "tao/orbconf.h" +#include "tao/ORB_Core.h" #if (TAO_HAS_CORBA_MESSAGING == 1) @@ -21,6 +21,9 @@ #include "Collocated_Object.h" #include "tao/TimeBaseS.h" #include "tao/MessagingC.h" +#include "tao/PortableServer/ThruPOA_Object_Proxy_Impl.h" +#include "tao/PortableServer/Direct_Object_Proxy_Impl.h" +#include "tao/PortableServer/ServerRequestInfo.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -37,7 +40,11 @@ TAO_NAMESPACE POA_Messaging { #if (TAO_HAS_AMI_CALLBACK == 1) - + + // Forward Classes Declaration + class _TAO_ReplyHandler_ThruPOA_Proxy_Impl; + class _TAO_ReplyHandler_Direct_Proxy_Impl; + class _TAO_ReplyHandler_Strategized_Proxy_Broker; class ReplyHandler; typedef ReplyHandler *ReplyHandler_ptr; class TAO_PortableServer_Export ReplyHandler : public virtual PortableServer::ServantBase @@ -94,59 +101,89 @@ TAO_NAMESPACE POA_Messaging }; -#if !defined (_MESSAGING_REPLYHANDLER___THRU_POA_COLLOCATED_SH_) -#define _MESSAGING_REPLYHANDLER___THRU_POA_COLLOCATED_SH_ - - class TAO_PortableServer_Export _tao_thru_poa_collocated_ReplyHandler : public virtual ::Messaging::ReplyHandler + /////////////////////////////////////////////////////////////////////// + // Strategized Proxy Broker Declaration + // + + class TAO_PortableServer_Export _TAO_ReplyHandler_Strategized_Proxy_Broker : public virtual ::Messaging::_TAO_ReplyHandler_Proxy_Broker { - public: - _tao_thru_poa_collocated_ReplyHandler ( - TAO_Stub *stub - ); - virtual CORBA::Boolean _is_a( - const CORBA::Char *logical_type_id, - CORBA_Environment &ACE_TRY_ENV = TAO_default_environment () - ); + public: + _TAO_ReplyHandler_Strategized_Proxy_Broker (void); - virtual CORBA::Boolean _non_existent( - CORBA_Environment &ACE_TRY_ENV = TAO_default_environment () - ); - - }; - - -#endif /* end #if !defined */ + virtual ~_TAO_ReplyHandler_Strategized_Proxy_Broker (void); + virtual ::Messaging::_TAO_ReplyHandler_Proxy_Impl &select_proxy ( + ::Messaging::ReplyHandler *object, + CORBA_Environment &ACE_TRY_ENV = TAO_default_environment () + ); + + private: + + // Helper methods that takes care to create the proxy + // as soon as their use is necessary. + void create_proxy ( + TAO_ORB_Core::TAO_Collocation_Strategies strategy, + CORBA::Environment &ACE_TRY_ENV + ); + + private: + + // Caches the proxy implementations. The proxy implementation + // are totally stateless, and those can be shared by all the + // instances of a given IDL interface type. + ::Messaging::_TAO_ReplyHandler_Proxy_Impl + *proxy_cache_[TAO_ORB_Core::COLLOCATION_STRATEGIES_NUM]; + + ACE_SYNCH_MUTEX mutex_; + }; + + // This funxtion is used to get an handle to the unique instance + // of the Strategized Proxy Broker that is available for a given + // interface. + + _TAO_ReplyHandler_Strategized_Proxy_Broker *the_TAO_ReplyHandler_Strategized_Proxy_Broker (void); + + // + // End Strategized Proxy Broker Declaration + /////////////////////////////////////////////////////////////////////// + + +/////////////////////////////////////////////////////////////////////// +// ThruPOA Impl. Declaration +// -#if !defined (_MESSAGING_REPLYHANDLER___DIRECT_COLLOCATED_SH_) -#define _MESSAGING_REPLYHANDLER___DIRECT_COLLOCATED_SH_ +class TAO_PortableServer_Export _TAO_ReplyHandler_ThruPOA_Proxy_Impl : + public virtual ::Messaging::_TAO_ReplyHandler_Proxy_Impl, + public virtual TAO_ThruPOA_Object_Proxy_Impl +{ +public: + ~_TAO_ReplyHandler_ThruPOA_Proxy_Impl (void); + + }; - class TAO_PortableServer_Export _tao_direct_collocated_ReplyHandler : public virtual Messaging::ReplyHandler, public virtual TAO_Collocated_Object - { - public: - _tao_direct_collocated_ReplyHandler ( - ReplyHandler_ptr servant, - TAO_Stub *stub - ); - virtual CORBA::Boolean _is_a( - const CORBA::Char *logical_type_id, - CORBA_Environment &ACE_TRY_ENV = TAO_default_environment () - ); - virtual void *_tao_QueryInterface (ptr_arith_t type); - ReplyHandler_ptr _get_servant (void) const; +// +// ThruPOA Proxy Impl. Declaration +/////////////////////////////////////////////////////////////////////// - virtual CORBA::Boolean _non_existent( - CORBA_Environment &ACE_TRY_ENV = TAO_default_environment () - ); +/////////////////////////////////////////////////////////////////////// +// Direct Impl. Declaration +// - private: - ReplyHandler_ptr servant_; - }; + class TAO_PortableServer_Export _TAO_ReplyHandler_Direct_Proxy_Impl : + public virtual Messaging::_TAO_ReplyHandler_Proxy_Impl, + public virtual TAO_Direct_Object_Proxy_Impl + { + public: + ~_TAO_ReplyHandler_Direct_Proxy_Impl (void); + + }; +// +// Direct Proxy Impl. Declaration +/////////////////////////////////////////////////////////////////////// -#endif /* end #if !defined */ #if defined (ACE_HAS_USING_KEYWORD) diff --git a/TAO/tao/corba.h b/TAO/tao/corba.h index 4f65e7550b2..81ce893d146 100644 --- a/TAO/tao/corba.h +++ b/TAO/tao/corba.h @@ -43,6 +43,7 @@ #include "tao/Principal.h" #include "tao/TAO_Server_Request.h" #include "tao/Object.h" +#include "tao/Remote_Object_Proxy_Impl.h" #include "tao/LocalObject.h" #include "tao/Typecode.h" |