Defines the Object Adapter abstraction. More...
#include <Object_Adapter.h>
Classes | |
class | Active_Hint_Strategy |
This class uses active demux hint for POA active hint strategy. More... | |
class | Hint_Strategy |
Base class for POA active hint strategy. More... | |
class | iteratable_poa_name |
This class allows iteration over a folded poa name. More... | |
class | No_Hint_Strategy |
This class doesn't use any hints for POA active hint strategy. More... | |
class | poa_name_iterator |
Iterator for a folded poa name. More... | |
Public Types | |
typedef PortableServer::ObjectId | poa_name |
typedef PortableServer::ObjectId_var | poa_name_var |
typedef PortableServer::ObjectId_out | poa_name_out |
Public Member Functions | |
TAO_Object_Adapter (const TAO_Server_Strategy_Factory::Active_Object_Map_Creation_Parameters &creation_parameters, TAO_ORB_Core &orb_core) | |
Constructor. | |
~TAO_Object_Adapter (void) | |
Destructor. | |
int | dispatch_servant (const TAO::ObjectKey &key, TAO_ServerRequest &req, CORBA::Object_out forward_to) |
int | locate_servant (const TAO::ObjectKey &key) |
TAO_SERVANT_LOCATION | find_servant (const TAO::ObjectKey &key, PortableServer::Servant &servant) |
int | find_poa (const poa_name &system_name, CORBA::Boolean activate_it, CORBA::Boolean root, const TAO::Portable_Server::Temporary_Creation_Time &poa_creation_time, TAO_Root_POA *&poa) |
int | bind_poa (const poa_name &folded_name, TAO_Root_POA *poa, poa_name_out system_name) |
int | unbind_poa (TAO_Root_POA *poa, const poa_name &folded_name, const poa_name &system_name) |
int | activate_poa (const poa_name &folded_name, TAO_Root_POA *&poa) |
ACE_Lock & | lock (void) |
TAO_SYNCH_MUTEX & | thread_lock (void) |
ACE_Reverse_Lock< ACE_Lock > & | reverse_lock (void) |
TAO_Root_POA * | root_poa (void) const |
Access the root poa. | |
TAO_ORB_Core & | orb_core (void) const |
Access to ORB Core. | |
void | wait_for_non_servant_upcalls_to_complete (void) |
Wait for non-servant upcalls to complete. | |
void | wait_for_non_servant_upcalls_to_complete_no_throw (void) |
Non-exception throwing version. | |
TAO_Policy_Validator & | validator (void) |
Return the validator. | |
int | enable_locking () const |
TAO_POA_Policy_Set & | default_poa_policies (void) |
Return the set of default policies. | |
void | servant_dispatcher (TAO_Servant_Dispatcher *dispatcher) |
void | init_default_policies (TAO_POA_Policy_Set &policies) |
Initialize the default set of POA policies. | |
virtual void | open (void) |
Initialize the Adapter. | |
virtual void | close (int wait_for_completion) |
virtual void | check_close (int wait_for_completion) |
virtual int | priority (void) const |
virtual int | dispatch (TAO::ObjectKey &key, TAO_ServerRequest &request, CORBA::Object_out forward_to) |
Return the status.... | |
virtual const char * | name (void) const |
virtual CORBA::Object_ptr | root (void) |
virtual CORBA::Object_ptr | create_collocated_object (TAO_Stub *, const TAO_MProfile &) |
Create a collocated object using the given profile and stub. | |
virtual CORBA::Long | initialize_collocated_object (TAO_Stub *) |
TAO::Portable_Server::Non_Servant_Upcall * | non_servant_upcall_in_progress (void) const |
Static Public Member Functions | |
static CORBA::ULong | transient_poa_name_size (void) |
Protected Types | |
typedef ACE_Map< poa_name, TAO_Root_POA * > | transient_poa_map |
Base class of the id map. | |
typedef ACE_Hash_Map_Manager_Ex_Adapter < poa_name, TAO_Root_POA *, TAO_ObjectId_Hash, ACE_Equal_To< poa_name > , TAO_Incremental_Key_Generator > | transient_poa_hash_map |
Id hash map. | |
typedef ACE_Map_Manager_Adapter < poa_name, TAO_Root_POA *, TAO_Incremental_Key_Generator > | transient_poa_linear_map |
Id linear map. | |
typedef ACE_Active_Map_Manager_Adapter < poa_name, TAO_Root_POA *, TAO_Ignore_Original_Key_Adapter > | transient_poa_active_map |
Id active map. | |
typedef ACE_Map< poa_name, TAO_Root_POA * > | persistent_poa_name_map |
Base class of the name map. | |
typedef ACE_Hash_Map_Manager_Ex_Adapter < poa_name, TAO_Root_POA *, TAO_ObjectId_Hash, ACE_Equal_To < PortableServer::ObjectId > , ACE_Noop_Key_Generator < poa_name > > | persistent_poa_name_hash_map |
Id hash map. | |
typedef ACE_Map_Manager_Adapter < poa_name, TAO_Root_POA *, ACE_Noop_Key_Generator < poa_name > > | persistent_poa_name_linear_map |
Id linear map. | |
Protected Member Functions | |
int | locate_servant_i (const TAO::ObjectKey &key) |
TAO_SERVANT_LOCATION | find_servant_i (const TAO::ObjectKey &key, PortableServer::Servant &servant) |
void | dispatch_servant_i (const TAO::ObjectKey &key, TAO_ServerRequest &req, void *context) |
void | locate_poa (const TAO::ObjectKey &key, PortableServer::ObjectId &id, TAO_Root_POA *&poa) |
int | find_transient_poa (const poa_name &system_name, CORBA::Boolean root, const TAO::Portable_Server::Temporary_Creation_Time &poa_creation_time, TAO_Root_POA *&poa) |
int | find_persistent_poa (const poa_name &system_name, TAO_Root_POA *&poa) |
int | bind_transient_poa (TAO_Root_POA *poa, poa_name_out system_name) |
int | bind_persistent_poa (const poa_name &folded_name, TAO_Root_POA *poa, poa_name_out system_name) |
int | unbind_transient_poa (const poa_name &system_name) |
int | unbind_persistent_poa (const poa_name &folded_name, const poa_name &system_name) |
virtual void | do_dispatch (TAO_ServerRequest &req, TAO::Portable_Server::Servant_Upcall &upcall) |
Static Protected Member Functions | |
static ACE_Lock * | create_lock (int enable_locking, TAO_SYNCH_MUTEX &thread_lock) |
static void | set_transient_poa_name_size (const TAO_Server_Strategy_Factory::Active_Object_Map_Creation_Parameters &creation_parameters) |
Protected Attributes | |
Hint_Strategy * | hint_strategy_ |
TAO_Servant_Dispatcher * | servant_dispatcher_ |
Strategy for dispatching a request to a servant. | |
persistent_poa_name_map * | persistent_poa_name_map_ |
Persistent POA map. | |
transient_poa_map * | transient_poa_map_ |
Transient POA map. | |
TAO_ORB_Core & | orb_core_ |
int | enable_locking_ |
TAO_SYNCH_MUTEX | thread_lock_ |
ACE_Lock * | lock_ |
ACE_Reverse_Lock< ACE_Lock > | reverse_lock_ |
Static Protected Attributes | |
static CORBA::ULong | transient_poa_name_size_ = 0 |
Private Member Functions | |
TAO_ServantBase * | get_collocated_servant (const TAO_MProfile &mp) |
Helper method to get collocated servant. | |
Static Private Member Functions | |
static void | release_poa_manager_factory (TAO_POAManager_Factory *factory) |
Private Attributes | |
TAO_SYNCH_CONDITION | non_servant_upcall_condition_ |
Condition variable for waiting on non-servant upcalls to end. | |
TAO::Portable_Server::Non_Servant_Upcall * | non_servant_upcall_in_progress_ |
unsigned int | non_servant_upcall_nesting_level_ |
Current nesting level of non_servant_upcalls. | |
ACE_thread_t | non_servant_upcall_thread_ |
Id of thread making the non-servant upcall. | |
TAO_Root_POA * | root_ |
The Root POA. | |
TAO_POAManager_Factory * | poa_manager_factory_ |
The POAManager factory. | |
TAO_POA_Default_Policy_Validator | default_validator_ |
TAO_POA_Policy_Set | default_poa_policies_ |
Friends | |
class | TAO_Root_POA |
class | Active_Hint_Strategy |
class | No_Hint_Strategy |
class | TAO::Portable_Server::Non_Servant_Upcall |
class | TAO::Portable_Server::Servant_Upcall |
Defines the Object Adapter abstraction.
This class will be used as a facade for the POAs in a server
Definition at line 74 of file Object_Adapter.h.
Id hash map.
Definition at line 355 of file Object_Adapter.h.
typedef ACE_Map_Manager_Adapter< poa_name, TAO_Root_POA *, ACE_Noop_Key_Generator<poa_name> > TAO_Object_Adapter::persistent_poa_name_linear_map [protected] |
Id linear map.
Definition at line 362 of file Object_Adapter.h.
typedef ACE_Map< poa_name, TAO_Root_POA *> TAO_Object_Adapter::persistent_poa_name_map [protected] |
Base class of the name map.
Definition at line 347 of file Object_Adapter.h.
Definition at line 81 of file Object_Adapter.h.
Definition at line 83 of file Object_Adapter.h.
Definition at line 82 of file Object_Adapter.h.
typedef ACE_Active_Map_Manager_Adapter< poa_name, TAO_Root_POA *, TAO_Ignore_Original_Key_Adapter> TAO_Object_Adapter::transient_poa_active_map [protected] |
Id active map.
Definition at line 342 of file Object_Adapter.h.
typedef ACE_Hash_Map_Manager_Ex_Adapter< poa_name, TAO_Root_POA *, TAO_ObjectId_Hash, ACE_Equal_To<poa_name>, TAO_Incremental_Key_Generator> TAO_Object_Adapter::transient_poa_hash_map [protected] |
Id hash map.
Definition at line 327 of file Object_Adapter.h.
typedef ACE_Map_Manager_Adapter< poa_name, TAO_Root_POA *, TAO_Incremental_Key_Generator> TAO_Object_Adapter::transient_poa_linear_map [protected] |
Id linear map.
Definition at line 335 of file Object_Adapter.h.
typedef ACE_Map< poa_name, TAO_Root_POA *> TAO_Object_Adapter::transient_poa_map [protected] |
Base class of the id map.
Definition at line 318 of file Object_Adapter.h.
TAO_Object_Adapter::TAO_Object_Adapter | ( | const TAO_Server_Strategy_Factory::Active_Object_Map_Creation_Parameters & | creation_parameters, | |
TAO_ORB_Core & | orb_core | |||
) |
Constructor.
Definition at line 143 of file Object_Adapter.cpp.
: hint_strategy_ (0), servant_dispatcher_ (0), persistent_poa_name_map_ (0), transient_poa_map_ (0), orb_core_ (orb_core), enable_locking_ (orb_core_.server_factory ()->enable_poa_locking ()), thread_lock_ (), lock_ (TAO_Object_Adapter::create_lock (enable_locking_, thread_lock_)), reverse_lock_ (*lock_), non_servant_upcall_condition_ (thread_lock_), non_servant_upcall_in_progress_ (0), non_servant_upcall_nesting_level_ (0), non_servant_upcall_thread_ (ACE_OS::NULL_thread), root_ (0), #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO) poa_manager_factory_ (0), #endif default_validator_ (orb_core), default_poa_policies_ () { TAO_Object_Adapter::set_transient_poa_name_size (creation_parameters); Hint_Strategy *hint_strategy = 0; if (creation_parameters.use_active_hint_in_poa_names_) ACE_NEW (hint_strategy, Active_Hint_Strategy (creation_parameters.poa_map_size_)); else ACE_NEW (hint_strategy, No_Hint_Strategy); // Give ownership to the auto pointer. auto_ptr<Hint_Strategy> new_hint_strategy (hint_strategy); new_hint_strategy->object_adapter (this); persistent_poa_name_map *ppnm = 0; switch (creation_parameters.poa_lookup_strategy_for_persistent_id_policy_) { case TAO_LINEAR: #if (TAO_HAS_MINIMUM_POA_MAPS == 0) ACE_NEW (ppnm, persistent_poa_name_linear_map (creation_parameters.poa_map_size_)); break; #else ACE_ERROR ((LM_ERROR, "linear option for -ORBPersistentidPolicyDemuxStrategy " "not supported with minimum POA maps. " "Ingoring option to use default...\n")); /* FALL THROUGH */ #endif /* TAO_HAS_MINIMUM_POA_MAPS == 0 */ case TAO_DYNAMIC_HASH: default: ACE_NEW (ppnm, persistent_poa_name_hash_map (creation_parameters.poa_map_size_)); break; } // Give ownership to the auto pointer. auto_ptr<persistent_poa_name_map> new_persistent_poa_name_map (ppnm); transient_poa_map *tpm = 0; switch (creation_parameters.poa_lookup_strategy_for_transient_id_policy_) { #if (TAO_HAS_MINIMUM_POA_MAPS == 0) case TAO_LINEAR: ACE_NEW (tpm, transient_poa_linear_map (creation_parameters.poa_map_size_)); break; case TAO_DYNAMIC_HASH: ACE_NEW (tpm, transient_poa_hash_map (creation_parameters.poa_map_size_)); break; #else case TAO_LINEAR: case TAO_DYNAMIC_HASH: ACE_ERROR ((LM_ERROR, "linear and dynamic options for -ORBTransientidPolicyDemuxStrategy " "are not supported with minimum POA maps. " "Ingoring option to use default...\n")); /* FALL THROUGH */ #endif /* TAO_HAS_MINIMUM_POA_MAPS == 0 */ case TAO_ACTIVE_DEMUX: default: ACE_NEW (tpm, transient_poa_active_map (creation_parameters.poa_map_size_)); break; } // Give ownership to the auto pointer. auto_ptr<transient_poa_map> new_transient_poa_map (tpm); this->hint_strategy_ = new_hint_strategy.release (); this->persistent_poa_name_map_ = new_persistent_poa_name_map.release (); this->transient_poa_map_ = new_transient_poa_map.release (); }
TAO_Object_Adapter::~TAO_Object_Adapter | ( | void | ) |
Destructor.
Definition at line 294 of file Object_Adapter.cpp.
{ delete this->hint_strategy_; delete this->persistent_poa_name_map_; delete this->transient_poa_map_; delete this->lock_; delete this->servant_dispatcher_; // This cleanup may have already occurred in the close() method. If // that is the case then this won't cause any harm since root_ and // poa_manager_factory_ would have been set to zero. But, if close // wasn't called, then these would be leaked. It may be better if // these pointers had a corresponding _var version so that this cleanup // could be automatic. ::CORBA::release (this->root_); #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO) release_poa_manager_factory (this->poa_manager_factory_); #endif }
int TAO_Object_Adapter::activate_poa | ( | const poa_name & | folded_name, | |
TAO_Root_POA *& | poa | |||
) |
Definition at line 436 of file Object_Adapter.cpp.
{ int result = -1; #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_MICRO) iteratable_poa_name ipn (folded_name); iteratable_poa_name::iterator iterator = ipn.begin (); iteratable_poa_name::iterator end = ipn.end (); TAO_Root_POA *parent = this->root_; if (parent == 0 || parent->name () != *iterator) throw ::CORBA::OBJ_ADAPTER (); else ++iterator; for (; iterator != end; ++iterator) { TAO_Root_POA *current = 0; try { current = parent->find_POA_i (*iterator, 1); } catch (const PortableServer::POA::AdapterNonExistent&) { return -1; } parent = current; } poa = parent; result = 0; #else ACE_UNUSED_ARG (folded_name); ACE_UNUSED_ARG (poa); #endif /* TAO_HAS_MINIMUM_POA == 0 */ return result; }
int TAO_Object_Adapter::bind_persistent_poa | ( | const poa_name & | folded_name, | |
TAO_Root_POA * | poa, | |||
poa_name_out | system_name | |||
) | [protected] |
Definition at line 117 of file Object_Adapter.inl.
{ return this->hint_strategy_->bind_persistent_poa (folded_name, poa, system_name); }
int TAO_Object_Adapter::bind_poa | ( | const poa_name & | folded_name, | |
TAO_Root_POA * | poa, | |||
poa_name_out | system_name | |||
) |
Definition at line 506 of file Object_Adapter.cpp.
{ if (poa->persistent ()) return this->bind_persistent_poa (folded_name, poa, system_name); else return this->bind_transient_poa (poa, system_name); }
int TAO_Object_Adapter::bind_transient_poa | ( | TAO_Root_POA * | poa, | |
poa_name_out | system_name | |||
) | [protected] |
Definition at line 100 of file Object_Adapter.inl.
{ poa_name name; int result = this->transient_poa_map_->bind_create_key (poa, name); if (result == 0) { ACE_NEW_RETURN (system_name, poa_name (name), -1); } return result; }
void TAO_Object_Adapter::check_close | ( | int | wait_for_completion | ) | [virtual] |
Check if the adapter can be closed in the current context, raise an exception if not.
Implements TAO_Adapter.
Definition at line 701 of file Object_Adapter.cpp.
{ TAO_Root_POA::check_for_valid_wait_for_completions (this->orb_core (), wait_for_completion); }
void TAO_Object_Adapter::close | ( | int | wait_for_completion | ) | [virtual] |
The ORB is shutting down, destroy any resources attached to this adapter.
Implements TAO_Adapter.
Definition at line 662 of file Object_Adapter.cpp.
{ this->check_close (wait_for_completion); // Shutting down the ORB causes all object adapters to be destroyed, // since they cannot exist in the absence of an ORB. Shut down is // complete when all ORB processing (including request processing // and object deactivation or other operations associated with // object adapters) has completed and the object adapters have been // destroyed. In the case of the POA, this means that all object // etherealizations have finished and root POA has been destroyed // (implying that all descendent POAs have also been destroyed). TAO_Root_POA *root = 0; #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO) TAO_POAManager_Factory* factory = 0; #endif { ACE_GUARD (ACE_Lock, ace_mon, this->lock ()); if (this->root_ == 0) return; root = this->root_; this->root_ = 0; #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO) if (this->poa_manager_factory_ == 0) return; factory = this->poa_manager_factory_; this->poa_manager_factory_ = 0; #endif } CORBA::Boolean etherealize_objects = true; root->destroy (etherealize_objects, wait_for_completion); ::CORBA::release (root); #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO) release_poa_manager_factory (factory); #endif }
CORBA::Object_ptr TAO_Object_Adapter::create_collocated_object | ( | TAO_Stub * | , | |
const TAO_MProfile & | ||||
) | [virtual] |
Create a collocated object using the given profile and stub.
Implements TAO_Adapter.
Definition at line 858 of file Object_Adapter.cpp.
{ TAO_ServantBase *sb = this->get_collocated_servant (mp); // Set the servant ORB. Do not duplicate the ORB here since // TAO_Stub::servant_orb() duplicates it. stub->servant_orb (this->orb_core_.orb ()); // It is ok to create a collocated object even when <sb> is // zero. This constructor will set the stub collocated indicator and // the strategized proxy broker if required. CORBA::Object_ptr x; ACE_NEW_RETURN (x, CORBA::Object (stub, 1, sb), CORBA::Object::_nil ()); // Success. return x; }
ACE_Lock * TAO_Object_Adapter::create_lock | ( | int | enable_locking, | |
TAO_SYNCH_MUTEX & | thread_lock | |||
) | [static, protected] |
Definition at line 317 of file Object_Adapter.cpp.
{ #if defined (ACE_HAS_THREADS) if (enable_locking) { ACE_Lock *the_lock = 0; ACE_NEW_RETURN (the_lock, ACE_Lock_Adapter<TAO_SYNCH_MUTEX> (thread_lock), 0); return the_lock; } #else ACE_UNUSED_ARG (enable_locking); ACE_UNUSED_ARG (thread_lock); #endif /* ACE_HAS_THREADS */ ACE_Lock *the_lock = 0; ACE_NEW_RETURN (the_lock, ACE_Lock_Adapter<ACE_SYNCH_NULL_MUTEX> (), 0); return the_lock; }
TAO_POA_Policy_Set & TAO_Object_Adapter::default_poa_policies | ( | void | ) |
Return the set of default policies.
Definition at line 23 of file Object_Adapter.inl.
{ return this->default_poa_policies_; }
int TAO_Object_Adapter::dispatch | ( | TAO::ObjectKey & | key, | |
TAO_ServerRequest & | request, | |||
CORBA::Object_out | forward_to | |||
) | [virtual] |
Return the status....
Implements TAO_Adapter.
Definition at line 714 of file Object_Adapter.cpp.
{ if (key.length() < TAO_Root_POA::TAO_OBJECTKEY_PREFIX_SIZE || ACE_OS::memcmp (key.get_buffer (), &TAO_Root_POA::objectkey_prefix[0], TAO_Root_POA::TAO_OBJECTKEY_PREFIX_SIZE) != 0) { return TAO_Adapter::DS_MISMATCHED_KEY; } int result = 0; #if TAO_HAS_INTERCEPTORS == 1 TAO::ServerRequestInterceptor_Adapter *sri_adapter = orb_core_.serverrequestinterceptor_adapter (); try { if (sri_adapter != 0) { #if TAO_HAS_EXTENDED_FT_INTERCEPTORS == 1 CORBA::OctetSeq_var ocs; sri_adapter->tao_ft_interception_point (request, 0, // args 0, // nargs 0, // servant_upcall 0, // exceptions 0, // nexceptions ocs.out ()); /// If we have a cached result, just go ahead and send the reply /// and let us return if (ocs.ptr () != 0) { // request.result_seq ( request.send_cached_reply (ocs.inout ()); return TAO_Adapter::DS_OK; } // If a PortableInterceptor::ForwardRequest exception was // thrown, then set the forward_to object reference and return // with the appropriate return status. forward_to.ptr () = request.forward_location (); if (request.is_forwarded ()) { return TAO_Adapter::DS_FORWARD; } #endif /*TAO_HAS_EXTENDED_FT_INTERCEPTORS*/ // The receive_request_service_contexts() interception point // must be invoked before the operation is dispatched to the // servant. sri_adapter->receive_request_service_contexts (request, 0, // args 0, // nargs 0, // servant_upcall 0, // exceptions 0); // nexceptions // If a PortableInterceptor::ForwardRequest exception was // thrown, then set the forward_to object reference and return // with the appropriate return status. forward_to.ptr () = request.forward_location (); if (request.is_forwarded ()) { return TAO_Adapter::DS_FORWARD; } } #endif /* TAO_HAS_INTERCEPTORS == 1 */ result = this->dispatch_servant (key, request, forward_to); #if TAO_HAS_INTERCEPTORS == 1 if (result == TAO_Adapter::DS_FORWARD) { request.reply_status (GIOP::LOCATION_FORWARD); request.pi_reply_status (PortableInterceptor::LOCATION_FORWARD); request.forward_location (forward_to.ptr ()); if (sri_adapter != 0) { sri_adapter->send_other (request, 0, // args 0, // nargs 0, // servant_upcall 0, // exceptions 0 // nexceptions ); } } } catch ( ::CORBA::Exception& ex) { // Just assume the current exception is a system exception, the // status can only change when the interceptor changes this // and this is only done when the sri_adapter is available. If we // don't have an sri_adapter we just rethrow the exception PortableInterceptor::ReplyStatus status = PortableInterceptor::SYSTEM_EXCEPTION; if (sri_adapter != 0) { request.caught_exception (&ex); sri_adapter->send_exception (request, 0, // args 0, // nargs 0, // servant_upcall 0, // exceptions 0); // nexceptions status = request.pi_reply_status (); } // Only re-throw the exception if it hasn't been transformed by // the send_exception() interception point (e.g. to a // LOCATION_FORWARD). if (status == PortableInterceptor::SYSTEM_EXCEPTION || status == PortableInterceptor::USER_EXCEPTION) { throw; } } #endif /* TAO_HAS_INTERCEPTORS == 1 */ return result; }
int TAO_Object_Adapter::dispatch_servant | ( | const TAO::ObjectKey & | key, | |
TAO_ServerRequest & | req, | |||
CORBA::Object_out | forward_to | |||
) |
Definition at line 342 of file Object_Adapter.cpp.
{ ACE_FUNCTION_TIMEPROBE (TAO_OBJECT_ADAPTER_DISPATCH_SERVANT_START); // This object is magical, i.e., it has a non-trivial constructor // and destructor. TAO::Portable_Server::Servant_Upcall servant_upcall (&this->orb_core_); // Set up state in the POA et al (including the POA Current), so // that we know that this servant is currently in an upcall. const char *operation = req.operation (); int result = servant_upcall.prepare_for_upcall (key, operation, forward_to); if (result != TAO_Adapter::DS_OK) return result; // Preprocess request. if (req.collocated ()) { servant_upcall.pre_invoke_collocated_request (); } else { servant_upcall.pre_invoke_remote_request (req); } // Servant dispatch. { ACE_FUNCTION_TIMEPROBE (TAO_SERVANT_DISPATCH_START); do_dispatch (req, servant_upcall); } #if TAO_HAS_INTERCEPTORS == 1 // ServerInterceptor might have raised ForwardRequest. In case of // remote calls invocations the LocationForwardReply would have been // sent in earlier stage, but in colocal scenario no message is sent // and the LocationForward object must be passed over here to // calling operation's mem-space. if (req.collocated() && req.pi_reply_status () == PortableInterceptor::LOCATION_FORWARD) { forward_to = req.forward_location (); result = TAO_Adapter::DS_FORWARD; } #endif return result; }
void TAO_Object_Adapter::dispatch_servant_i | ( | const TAO::ObjectKey & | key, | |
TAO_ServerRequest & | req, | |||
void * | context | |||
) | [protected] |
void TAO_Object_Adapter::do_dispatch | ( | TAO_ServerRequest & | req, | |
TAO::Portable_Server::Servant_Upcall & | upcall | |||
) | [protected, virtual] |
Reimplemented in TAO_CSD_Object_Adapter.
Definition at line 1217 of file Object_Adapter.cpp.
{ upcall.servant ()->_dispatch(req, &upcall); }
int TAO_Object_Adapter::enable_locking | ( | void | ) | const |
Definition at line 17 of file Object_Adapter.inl.
{ return this->enable_locking_; }
int TAO_Object_Adapter::find_persistent_poa | ( | const poa_name & | system_name, | |
TAO_Root_POA *& | poa | |||
) | [protected] |
Definition at line 73 of file Object_Adapter.inl.
{ return this->hint_strategy_->find_persistent_poa (system_name, poa); }
int TAO_Object_Adapter::find_poa | ( | const poa_name & | system_name, | |
CORBA::Boolean | activate_it, | |||
CORBA::Boolean | root, | |||
const TAO::Portable_Server::Temporary_Creation_Time & | poa_creation_time, | |||
TAO_Root_POA *& | poa | |||
) |
Definition at line 80 of file Object_Adapter.inl.
{ if (activate_it) { return this->find_persistent_poa (system_name, poa); } else { return this->find_transient_poa (system_name, root, poa_creation_time, poa); } }
TAO_SERVANT_LOCATION TAO_Object_Adapter::find_servant | ( | const TAO::ObjectKey & | key, | |
PortableServer::Servant & | servant | |||
) |
Definition at line 63 of file Object_Adapter.inl.
{ // Lock access for the duration of this transaction. TAO_OBJECT_ADAPTER_GUARD_RETURN (TAO_SERVANT_NOT_FOUND); return this->find_servant_i (key, servant); }
TAO_SERVANT_LOCATION TAO_Object_Adapter::find_servant_i | ( | const TAO::ObjectKey & | key, | |
PortableServer::Servant & | servant | |||
) | [protected] |
Definition at line 557 of file Object_Adapter.cpp.
{ PortableServer::ObjectId id; TAO_Root_POA *poa = 0; this->locate_poa (key, id, poa); return poa->locate_servant_i (id, servant); }
int TAO_Object_Adapter::find_transient_poa | ( | const poa_name & | system_name, | |
CORBA::Boolean | root, | |||
const TAO::Portable_Server::Temporary_Creation_Time & | poa_creation_time, | |||
TAO_Root_POA *& | poa | |||
) | [protected] |
Definition at line 482 of file Object_Adapter.cpp.
{ int result = 0; if (root) { poa = this->root_; } else { result = this->transient_poa_map_->find (system_name, poa); } if (poa == 0 || (result == 0 && !poa->validate_lifespan (false, poa_creation_time))) result = -1; return result; }
TAO_ServantBase * TAO_Object_Adapter::get_collocated_servant | ( | const TAO_MProfile & | mp | ) | [private] |
Helper method to get collocated servant.
Definition at line 920 of file Object_Adapter.cpp.
{ for (TAO_PHandle j = 0; j != mp.profile_count (); ++j) { const TAO_Profile *profile = mp.get_profile (j); TAO::ObjectKey_var objkey = profile->_key (); if (objkey->length() < TAO_Root_POA::TAO_OBJECTKEY_PREFIX_SIZE || ACE_OS::memcmp (objkey->get_buffer (), &TAO_Root_POA::objectkey_prefix[0], TAO_Root_POA::TAO_OBJECTKEY_PREFIX_SIZE) != 0) continue; TAO_ServantBase *servant = 0; try { this->find_servant (objkey.in (), servant); } catch (const ::CORBA::Exception&) { } return servant; } return 0; }
void TAO_Object_Adapter::init_default_policies | ( | TAO_POA_Policy_Set & | policies | ) |
Initialize the default set of POA policies.
Definition at line 245 of file Object_Adapter.cpp.
{ // Initialize the default policies. #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO) TAO::Portable_Server::ThreadPolicy thread_policy (PortableServer::ORB_CTRL_MODEL); policies.merge_policy (&thread_policy); #endif /* TAO_HAS_MINIMUM_POA == 0 */ #if !defined (CORBA_E_MICRO) // Lifespan policy. TAO::Portable_Server::LifespanPolicy lifespan_policy (PortableServer::TRANSIENT); policies.merge_policy (&lifespan_policy); #endif #if !defined (CORBA_E_MICRO) // ID uniqueness policy. TAO::Portable_Server::IdUniquenessPolicy id_uniqueness_policy (PortableServer::UNIQUE_ID); policies.merge_policy (&id_uniqueness_policy); #endif #if !defined (CORBA_E_MICRO) // ID assignment policy. TAO::Portable_Server::IdAssignmentPolicy id_assignment_policy (PortableServer::SYSTEM_ID); policies.merge_policy (&id_assignment_policy); #endif #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO) // Implicit activation policy. TAO::Portable_Server::ImplicitActivationPolicy implicit_activation_policy (PortableServer::NO_IMPLICIT_ACTIVATION); policies.merge_policy (&implicit_activation_policy); // Servant retention policy. TAO::Portable_Server::ServantRetentionPolicy servant_retention_policy (PortableServer::RETAIN); policies.merge_policy (&servant_retention_policy); // Request processing policy. TAO::Portable_Server::RequestProcessingPolicy request_processing_policy (PortableServer::USE_ACTIVE_OBJECT_MAP_ONLY); policies.merge_policy (&request_processing_policy); #endif /* TAO_HAS_MINIMUM_POA == 0 */ #if defined (CORBA_E_MICRO) ACE_UNUSED_ARG (policies); #endif }
CORBA::Long TAO_Object_Adapter::initialize_collocated_object | ( | TAO_Stub * | ) | [virtual] |
Initialize a collocated object using the given stub pointer for lazily evaluated object references.
Implements TAO_Adapter.
Definition at line 882 of file Object_Adapter.cpp.
{ // If we have been forwarded: use the forwarded profiles const TAO_MProfile &mp = stub->forward_profiles () ? *(stub->forward_profiles ()) : stub->base_profiles (); TAO_ServantBase *sb = this->get_collocated_servant (mp); // Set the servant ORB. Do not duplicate the ORB here since // TAO_Stub::servant_orb() duplicates it. stub->servant_orb (this->orb_core_.orb ()); // It is ok to set the object as a collocated object even when // <sb> is zero. stub->collocated_servant (sb); // Mark the stub as collocated. This will set the strategized object // proxy broker if required. stub->is_collocated (true); // Return 0 (success) iff we found a servant. return ! sb; }
void TAO_Object_Adapter::locate_poa | ( | const TAO::ObjectKey & | key, | |
PortableServer::ObjectId & | id, | |||
TAO_Root_POA *& | poa | |||
) | [protected] |
Definition at line 394 of file Object_Adapter.cpp.
{ TAO_Object_Adapter::poa_name poa_system_name; CORBA::Boolean is_root = false; CORBA::Boolean is_persistent = false; CORBA::Boolean is_system_id = false; TAO::Portable_Server::Temporary_Creation_Time poa_creation_time; int result = 0; { ACE_FUNCTION_TIMEPROBE (TAO_POA_PARSE_KEY_START); result = TAO_Root_POA::parse_key (key, poa_system_name, system_id, is_root, is_persistent, is_system_id, poa_creation_time); } if (result != 0) throw ::CORBA::OBJ_ADAPTER (); { ACE_FUNCTION_TIMEPROBE (TAO_OBJECT_ADAPTER_FIND_POA_START); result = this->find_poa (poa_system_name, is_persistent, is_root, poa_creation_time, poa); } if (result != 0) throw ::CORBA::OBJECT_NOT_EXIST (CORBA::OMGVMCID | 2, CORBA::COMPLETED_NO); }
int TAO_Object_Adapter::locate_servant | ( | const TAO::ObjectKey & | key | ) |
Definition at line 54 of file Object_Adapter.inl.
{ // Lock access for the duration of this transaction. TAO_OBJECT_ADAPTER_GUARD_RETURN (-1); return this->locate_servant_i (key); }
int TAO_Object_Adapter::locate_servant_i | ( | const TAO::ObjectKey & | key | ) | [protected] |
Definition at line 528 of file Object_Adapter.cpp.
{ ACE_FUNCTION_TIMEPROBE (TAO_POA_LOCATE_SERVANT_START); PortableServer::ObjectId id; TAO_Root_POA *poa = 0; this->locate_poa (key, id, poa); PortableServer::Servant servant = 0; TAO_SERVANT_LOCATION servant_location = poa->locate_servant_i (id, servant); switch (servant_location) { case TAO_SERVANT_FOUND: // Optimistic attitude case TAO_DEFAULT_SERVANT: case TAO_SERVANT_MANAGER: return 0; case TAO_SERVANT_NOT_FOUND: return -1; } return -1; }
ACE_Lock & TAO_Object_Adapter::lock | ( | void | ) |
Definition at line 29 of file Object_Adapter.inl.
{ return *this->lock_; }
const char * TAO_Object_Adapter::name | ( | void | ) | const [virtual] |
Return the name, i.e. the object id used to resolve it in the ORB.
Implements TAO_Adapter.
Definition at line 846 of file Object_Adapter.cpp.
{
return TAO_OBJID_ROOTPOA;
}
TAO::Portable_Server::Non_Servant_Upcall * TAO_Object_Adapter::non_servant_upcall_in_progress | ( | void | ) | const |
Pointer to the non-servant upcall in progress. If no non-servant upcall is in progress, this pointer is zero.
Definition at line 153 of file Object_Adapter.inl.
{ return this->non_servant_upcall_in_progress_; }
void TAO_Object_Adapter::open | ( | void | ) | [virtual] |
Initialize the Adapter.
Implements TAO_Adapter.
Definition at line 569 of file Object_Adapter.cpp.
{ // Add in the default POA policies to the default list. this->init_default_policies (this->default_poa_policies ()); // If a POA extension hasn't changed the servant dispatcher, initialize the // default one. if (this->servant_dispatcher_ == 0) { ACE_NEW (this->servant_dispatcher_, TAO_Default_Servant_Dispatcher); } #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO) ACE_NEW_THROW_EX (this->poa_manager_factory_, TAO_POAManager_Factory (*this), CORBA::NO_MEMORY ()); ::CORBA::PolicyList policy; PortableServer::POAManager_var poa_manager = poa_manager_factory_->create_POAManager (TAO_DEFAULT_ROOTPOAMANAGER_NAME, policy); #else PortableServer::POAManager_ptr poa_manager_ptr; ::CORBA::PolicyList policy_list; ACE_NEW_THROW_EX (poa_manager_ptr, TAO_POA_Manager (*this, TAO_DEFAULT_ROOTPOAMANAGER_NAME), CORBA::NO_MEMORY (CORBA::SystemException::_tao_minor_code (0, ENOMEM), CORBA::COMPLETED_NO)); PortableServer::POAManager_var poa_manager = poa_manager_ptr; // Keep reference of POAManager in TAO_Object_Adapter so the POAManager // object is destructed after RootPOA is destructed. the_poa_manager_ = poa_manager; #endif // This makes sure that the default resources are open when the Root // POA is created. this->orb_core_.thread_lane_resources_manager ().open_default_resources (); TAO_POA_Policy_Set policies (this->default_poa_policies ()); #if (TAO_HAS_MINIMUM_POA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO) // Specify the implicit activation policy since it should // be different from the default. Note that merge_policy // takes a const reference and makes its own copy of the // policy. (Otherwise, we'd have to allocate the policy // on the heap.) // Implicit activation policy. TAO::Portable_Server::ImplicitActivationPolicy implicit_activation_policy (PortableServer::IMPLICIT_ACTIVATION); policies.merge_policy (&implicit_activation_policy); #endif /* TAO_HAS_MINIMUM_POA == 0 */ // Merge policies from the ORB level. this->validator ().merge_policies (policies.policies ()); // If any of the policy objects specified are not valid for the ORB // implementation, if conflicting policy objects are specified, or // if any of the specified policy objects require prior // administrative action that has not been performed, an // InvalidPolicy exception is raised containing the index in the // policies parameter value of the first offending policy object. policies.validate_policies (this->validator (), this->orb_core_); // Construct a new POA TAO_Root_POA::String root_poa_name (TAO_DEFAULT_ROOTPOA_NAME); this->root_ = this->servant_dispatcher_->create_Root_POA (root_poa_name, poa_manager.in (), policies, this->lock (), this->thread_lock (), this->orb_core_, this); // The Object_Adapter will keep a reference to the Root POA so that // on its destruction, it can check whether the Root POA has been // destroyed yet or not. this->root_->_add_ref (); // Lock access for the duration of this transaction. TAO::Portable_Server::POA_Guard poa_guard (*this->root_); // Iterate over the registered IOR interceptors so that they may be // given the opportunity to add tagged components to the profiles // for this servant. this->root_->establish_components (); }
TAO_ORB_Core & TAO_Object_Adapter::orb_core | ( | void | ) | const |
int TAO_Object_Adapter::priority | ( | void | ) | const [virtual] |
Return the priority assigned to this adapter. Adapters at higher priority are used first, the first adapter that matches a key is used to dispatch a request.
Implements TAO_Adapter.
Definition at line 708 of file Object_Adapter.cpp.
{
return 0;
}
void TAO_Object_Adapter::release_poa_manager_factory | ( | TAO_POAManager_Factory * | factory | ) | [static, private] |
Definition at line 908 of file Object_Adapter.cpp.
{ if (factory != 0) { factory->remove_all_poamanagers (); ::CORBA::release (factory); } }
ACE_Reverse_Lock< ACE_Lock > & TAO_Object_Adapter::reverse_lock | ( | void | ) |
Definition at line 41 of file Object_Adapter.inl.
{ return this->reverse_lock_; }
CORBA::Object_ptr TAO_Object_Adapter::root | ( | void | ) | [virtual] |
Return the root of the Object Adapter. Each adapter defines its own IDL interface accessed through the method above.
Implements TAO_Adapter.
Definition at line 852 of file Object_Adapter.cpp.
{ return CORBA::Object::_duplicate (this->root_); }
TAO_Root_POA * TAO_Object_Adapter::root_poa | ( | void | ) | const |
void TAO_Object_Adapter::servant_dispatcher | ( | TAO_Servant_Dispatcher * | dispatcher | ) |
Set the servant dispatcher method. Ownership is transferred to this Object Adapter. Note: This should only be called at initialization.
Definition at line 1208 of file Object_Adapter.cpp.
{ if (this->servant_dispatcher_) delete this->servant_dispatcher_; this->servant_dispatcher_ = dispatcher; }
void TAO_Object_Adapter::set_transient_poa_name_size | ( | const TAO_Server_Strategy_Factory::Active_Object_Map_Creation_Parameters & | creation_parameters | ) | [static, protected] |
Definition at line 117 of file Object_Adapter.cpp.
{ if (TAO_Object_Adapter::transient_poa_name_size_ == 0) { switch (creation_parameters.poa_lookup_strategy_for_transient_id_policy_) { #if (TAO_HAS_MINIMUM_POA_MAPS == 0) case TAO_LINEAR: TAO_Object_Adapter::transient_poa_name_size_ = sizeof (CORBA::ULong); break; case TAO_DYNAMIC_HASH: TAO_Object_Adapter::transient_poa_name_size_ = sizeof (CORBA::ULong); break; #endif /* TAO_HAS_MINIMUM_POA_MAPS == 0 */ case TAO_ACTIVE_DEMUX: default: TAO_Object_Adapter::transient_poa_name_size_ = static_cast <CORBA::ULong>( ACE_Active_Map_Manager_Key::size ()); break; } } }
TAO_SYNCH_MUTEX & TAO_Object_Adapter::thread_lock | ( | void | ) |
Definition at line 35 of file Object_Adapter.inl.
{ return this->thread_lock_; }
CORBA::ULong TAO_Object_Adapter::transient_poa_name_size | ( | void | ) | [static] |
Definition at line 48 of file Object_Adapter.inl.
{ return TAO_Object_Adapter::transient_poa_name_size_; }
int TAO_Object_Adapter::unbind_persistent_poa | ( | const poa_name & | folded_name, | |
const poa_name & | system_name | |||
) | [protected] |
Definition at line 133 of file Object_Adapter.inl.
{ return this->hint_strategy_->unbind_persistent_poa (folded_name, system_name); }
int TAO_Object_Adapter::unbind_poa | ( | TAO_Root_POA * | poa, | |
const poa_name & | folded_name, | |||
const poa_name & | system_name | |||
) |
Definition at line 517 of file Object_Adapter.cpp.
{ if (poa->persistent ()) return this->unbind_persistent_poa (folded_name, system_name); else return this->unbind_transient_poa (system_name); }
int TAO_Object_Adapter::unbind_transient_poa | ( | const poa_name & | system_name | ) | [protected] |
Definition at line 127 of file Object_Adapter.inl.
{ return this->transient_poa_map_->unbind (system_name); }
TAO_Policy_Validator & TAO_Object_Adapter::validator | ( | void | ) |
Return the validator.
Definition at line 11 of file Object_Adapter.inl.
{ return this->default_validator_; }
void TAO_Object_Adapter::wait_for_non_servant_upcalls_to_complete | ( | void | ) |
Wait for non-servant upcalls to complete.
Definition at line 1174 of file Object_Adapter.cpp.
{ // 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. while (this->enable_locking_ && this->non_servant_upcall_in_progress_ && ! ACE_OS::thr_equal (this->non_servant_upcall_thread_, ACE_OS::thr_self ())) { // If so wait... int const result = this->non_servant_upcall_condition_.wait (); if (result == -1) throw ::CORBA::OBJ_ADAPTER (); } }
void TAO_Object_Adapter::wait_for_non_servant_upcalls_to_complete_no_throw | ( | void | ) |
Non-exception throwing version.
Definition at line 1192 of file Object_Adapter.cpp.
{ // Non-exception throwing version. try { this->wait_for_non_servant_upcalls_to_complete (); } catch (const ::CORBA::Exception&) { ACE_ERROR ((LM_ERROR, "TAO_Object_Adapter::wait_for_non_servant_upcalls_to_complete " "threw exception it should not have!\n")); } }
friend class Active_Hint_Strategy [friend] |
Definition at line 280 of file Object_Adapter.h.
friend class No_Hint_Strategy [friend] |
Definition at line 309 of file Object_Adapter.h.
friend class TAO::Portable_Server::Non_Servant_Upcall [friend] |
Definition at line 445 of file Object_Adapter.h.
friend class TAO::Portable_Server::Servant_Upcall [friend] |
Definition at line 447 of file Object_Adapter.h.
friend class TAO_Root_POA [friend] |
Definition at line 79 of file Object_Adapter.h.
Save a list of default policies that should be included in every POA (unless overridden).
Definition at line 495 of file Object_Adapter.h.
The default validator and the beginning of the chain of policy validators.
Definition at line 491 of file Object_Adapter.h.
int TAO_Object_Adapter::enable_locking_ [protected] |
Definition at line 382 of file Object_Adapter.h.
Hint_Strategy* TAO_Object_Adapter::hint_strategy_ [protected] |
Definition at line 313 of file Object_Adapter.h.
ACE_Lock* TAO_Object_Adapter::lock_ [protected] |
Definition at line 386 of file Object_Adapter.h.
TAO_SYNCH_CONDITION TAO_Object_Adapter::non_servant_upcall_condition_ [private] |
Condition variable for waiting on non-servant upcalls to end.
Definition at line 466 of file Object_Adapter.h.
TAO::Portable_Server::Non_Servant_Upcall* TAO_Object_Adapter::non_servant_upcall_in_progress_ [private] |
Pointer to the non-servant upcall in progress. If no non-servant upcall is in progress, this pointer is zero.
Definition at line 470 of file Object_Adapter.h.
unsigned int TAO_Object_Adapter::non_servant_upcall_nesting_level_ [private] |
Current nesting level of non_servant_upcalls.
Definition at line 473 of file Object_Adapter.h.
Id of thread making the non-servant upcall.
Definition at line 476 of file Object_Adapter.h.
TAO_ORB_Core& TAO_Object_Adapter::orb_core_ [protected] |
Definition at line 380 of file Object_Adapter.h.
Persistent POA map.
Definition at line 369 of file Object_Adapter.h.
The POAManager factory.
Definition at line 483 of file Object_Adapter.h.
ACE_Reverse_Lock<ACE_Lock> TAO_Object_Adapter::reverse_lock_ [protected] |
Definition at line 388 of file Object_Adapter.h.
TAO_Root_POA* TAO_Object_Adapter::root_ [private] |
The Root POA.
Definition at line 479 of file Object_Adapter.h.
Strategy for dispatching a request to a servant.
Definition at line 366 of file Object_Adapter.h.
TAO_SYNCH_MUTEX TAO_Object_Adapter::thread_lock_ [protected] |
Definition at line 384 of file Object_Adapter.h.
transient_poa_map* TAO_Object_Adapter::transient_poa_map_ [protected] |
Transient POA map.
Definition at line 372 of file Object_Adapter.h.
CORBA::ULong TAO_Object_Adapter::transient_poa_name_size_ = 0 [static, protected] |
Definition at line 376 of file Object_Adapter.h.