📄 poaimpl.h
字号:
static PortableServer::POA_ptr omniINSPOA(); // Returns a reference to the "magic" Interoperable Naming Service // POA. The INS POA is a child of the root poa (which is initialised // by this call if necessary), with the PERSISTENT and USER_ID // policies. It is normal in every way, except that the object keys // it creates contain only the object ids, and no POA identifier. // This allows objects with keys like "NameService", as required by // the INS. // This function is thread-safe. static void shutdown(); // Destroys the root poa, waiting for completion. If the // poa has not been initialised, or has already been destroyed // then this does nothing. // Must not be in the context of a CORBA call. // Not thread safe. static omniOrbPOA* getAdapter(const _CORBA_Octet* key, int keysize); // Attempts to find the adapter which generated the given key, // activating it if necassary. Returns zero if the key is not // a valid POA key, or the POA cannot be found or activated. // Throws OBJ_ADAPTER if an adapter activator throws a system // exception. PortableServer::ObjectId* localId_to_ObjectId(omniIdentity* lid); void localId_to_ObjectId(omniIdentity* lid, PortableServer::ObjectId& oid); // For the given omniIdentity within this POA, return its ObjectId.private: void create_key(omniObjKey& key_out, const CORBA::Octet* id, int idsize); void create_new_key(omniObjKey& key_out, const CORBA::Octet** id = 0, int* idsize = 0); // Must hold <pd_lock>. omniOrbPOA* find_child(const char* name); omniOrbPOA* find_child(const char* name_start, const char* name_end); // Does not increment the ref count of the returned POA. // Returns 0 if not found. // Must hold <poa_lock>. void insert_child(omniOrbPOA* child); // Must hold <poa_lock>. void lose_child(omniOrbPOA* child); // Removes the child from our list of children, but does not // release the reference. // Must hold <poa_lock>. int adapter_name_is_valid(const char* name); // Return true if <name> is a valid name for an adapter. void synchronise_request(omniLocalIdentity* lid); // Must hold <omni::internalLock> on entry. If the POA is in the // DISCARDING or INACTIVE state, <omni::internalLock> is released, // and a suitable exception is thrown. If the state is HOLDING, // blocks until the state changes. If it is (or becomes) ACTIVE, // and the object is still active, just returns -- and the mutex is // still held on exit. If the object has been deactivated while the // POA is in the HOLDING state, releases <omni::internalLock> and // throws CORBA::TRANSIENT. void deactivate_objects(omniObjTableEntry* entries); // Deactivate all objects in the given list. Does not etherealise // (or detach) any of them. // Must hold <omni::internalLock>. void complete_object_deactivation(omniObjTableEntry* entries); // Call omniLocalIdentity::deactivate() on each object in the // list. Assumes that all the objects have been deactivated // using deactivate_objects() above. The objects must also // all be idle -- otherwise the POA will be asked to etherealise // them when they become idle. // Must hold <omni::internalLock>. void etherealise_objects(omniObjTableEntry* entries, _CORBA_Boolean etherealise, PortableServer::ServantActivator_ptr sa); // Etherealises the objects in the given list (if <etherealise> // is true). The objects *must* all be idle. // <sa> may be zero. void add_object_to_etherealisation_queue(omniObjTableEntry* entry, PortableServer::ServantActivator_ptr sa, int cleanup_in_progress, int detached=0); // Places the servant associated with the given object onto a queue // to be etherealised by the given ServantActivator. This is done // in a separate thread. // If <detached> then the object has already been 'detached' from // the adapter (so <pd_nOutstandingDeadObjects> is not incremented). // Must not hold <omni::internalLock>. void dispatch_to_ds(omniCallHandle&, const _CORBA_Octet*, int); void dispatch_to_sa(omniCallHandle&, const _CORBA_Octet*, int); void dispatch_to_sl(omniCallHandle&, const _CORBA_Octet*, int); // Called from dispatch(), to deal with dispatches using the // default servant, ServantActivator and ServantLocator // respectively. class SLPostInvokeHook : public omniCallHandle::PostInvokeHook { public: SLPostInvokeHook(omniOrbPOA* poa, PortableServer::ServantLocator_ptr sl, PortableServer::ObjectId& oid, const char* op, PortableServer::ServantLocator::Cookie cookie, PortableServer::Servant servant) : pd_poa(poa), pd_sl(sl), pd_oid(oid), pd_op(op), pd_cookie(cookie), pd_servant(servant) {} virtual void postinvoke(); ~SLPostInvokeHook(); // Non-virtual because hook is created on the // stack and therefore always deleted by its // most derived type. private: omniOrbPOA* pd_poa; PortableServer::ServantLocator_ptr pd_sl; PortableServer::ObjectId& pd_oid; const char* pd_op; PortableServer::ServantLocator::Cookie pd_cookie; PortableServer::Servant pd_servant; }; omniOrbPOA* attempt_to_activate_adapter(const char* name); // Attempts to activate a child POA by invoking the AdapterActivator. // Returns 0 on failure, or the new child on sucess. Does not // increment the ref count of the returned POA. If another thread is // already doing so, then waits until it has finished, and returns // the result of that attempt. // Should only be called if we have an adapter activator, and the // child does not currently exist (or is dying). // Must hold <poa_lock>. It is still held on return, but is // released during the execution of this method. int start_adapteractivating_child_or_block(const char* name); // If we are already attempting to activate a child with this name, // block until we finish, and return 0. Otherwise record the fact // that we are starting, and return 1. // Must hold <poa_lock>. void finish_adapteractivating_child(const char* name); // Must hold <poa_lock>. int is_adapteractivating_child(const char* name); // Returns true if this POA is in the process of invoking an // AdapterActivator to create the child <name>. // Must hold <poa_lock>. int pd_destroyed; // True if this POA has been destroyed. This is set to 1 when // apparent destruction is complete. ie. All objects have // been deactivated, and outstanding requests have completed. // However, etherealisation of objects may not yet have // occurred. It is set to 2 when etherealisations are also // complete. <pd_deathSignal> is signalled each time it // changes. // NB. It is not always locked for reads, but since it is an // integer, reads should be atomic. // Protected by <pd_lock>. int pd_dying; // True if destroy() has been called for this POA, and so // it is in the process of being destroyed. // Protected by <pd_lock>. int pd_refCount; // Protected by <poa_lock>. CORBA::String_var pd_name; // Immutable. omniOrbPOA* pd_parent; // We don't own a reference to the parent -- it holds a // reference to us. This is nil only for a POA which has // been destroyed, and the root poa. // Mutable. Protected by <poa_lock>. omniOrbPOAManager* pd_manager; // We hold a reference to this. // Immutable. PortableServer::AdapterActivator_ptr pd_adapterActivator; // May be 0. // Mutable. Protected by <poa_lock>. omnivector<const char*> pd_adptrActvtnsInProgress; // List of names of child POAs which we are in the process // of activating using AdapterActivators. This is likely to // be empty most of the time! PortableServer::ServantActivator_ptr pd_servantActivator; PortableServer::ServantLocator_ptr pd_servantLocator; // At most one of these is non-zero, and then only if // pd_policy.req_processing == RPP_SERVANT_MANAGER. (We // use 0, rather than the nil object to represent absence // of these). Once set, they can never be changed. // Mutable. Protected by <pd_lock>. PortableServer::Servant pd_defaultServant; // We hold a reference to this servant. Only non-zero // if pd_policy.req_processing == RPP_DEFAULT_SERVANT, // and then only if the application has registered one. // Mutable. Protected by <pd_lock>. volatile int pd_rq_state; // Only changed in response to request by the POAManager, or // when this POA is destroyed. // Mutable. Protected by <omni::internalLock>. CORBA::String_var pd_fullname; // Name of this poa and all parents in \xff separated list. CORBA::String_var pd_poaId; int pd_poaIdSize; // Representation of the poa name in an object key // (including terminating '\0'). The size of an // object key is this size + the size of the id. // Immutable. ChildSeq pd_children; // The children of this POA, sorted in alphabetical order // of their adapter name. We hold a reference to each // child. // Mutable. Protected by <poa_lock>. Policies pd_policy; // Immutable.public: // For some reason, some compilers require this struct to be public struct MainThreadSync { omni_tracedmutex* mu; omni_tracedcondition* cond; };private: union { omni_rmutex* pd_call_lock; // This recursive lock is used to enforce the single threaded // model policy. if( pd_policy.threading == TP_SINGLE_THREAD ) // then a mutex is allocated. MainThreadSync pd_main_thread_sync; // This is used to implement the main thread policy. if // (pd_policy.threading == TP_MAIN_THREAD) then a mutex and // condition variable are allocated. These are used by the main // thread to signal the upcall thread when the call finishes. }; omni_tracedmutex pd_lock; // Protects access to various members. omni_tracedcondition pd_deathSignal; // This CV is broadcast to when the destruction of this POA is // complete (or nearly complete). // Uses <pd_lock> for mutex. _CORBA_ULong pd_oidIndex; // 32-bit value used as object id for POA allocated ids. // Used by create_new_key(). // Protected by <pd_lock>. omniObjTableEntry* pd_activeObjList; // A list of objects activated in this adapter. Includes only // those in the active object map. // Protected by <pd_lock>. _CORBA_Octet* pd_oidPrefix; // Unique id to prefix object ids when using the PERSISTENT and // SYSTEM_ID policies. // Immutable once allocated. No concurrency control.};OMNI_NAMESPACE_END(omni)#endif // __POAIMPL_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -