Previous Table of Contents Next


11.3.8 POA Policy Objects


   Interfaces derived from CORBA::Policy are used with the POA::create_POA operation to specify policies that apply to a POA. Policy objects are created using factory operations on any pre-existing POA, such as the root POA, or by a call to ORB::create_policy. Policy objects are specified when a POA is created. Policies may not be changed on an existing POA. Policies are not inherited from the parent POA. All Policy interfaces defined in this section are local interfaces.

   The POA shall preserve Policies whose types have been registered via PortableInterceptor::ORBInitInfo::register_policy_factory, even if the POA itself does not know about those policies.

   11.3.8.1 Thread Policy

   Objects with the ThreadPolicy interface are obtained using the POA::create_thread_policy operation and passed to the POA::create_POA operation to specify the threading model used with the created POA. The value attribute of ThreadPolicy contains the value supplied to the POA::create_thread_policy operation from which it was obtained. The following values can be supplied.

   If no ThreadPolicy object is passed to create_POA, the thread policy defaults to ORB_CTRL_MODEL.

   Note – In some environments, calling multi-thread-unaware code safely (that is, using the MAIN_THREAD_MODEL) may mean that the POA will use only the main thread, in which case the application programmer is responsible to ensure that the main thread is given to the ORB, using ORB::perform_work or ORB::run.

   POAs using the SINGLE_THREAD_MODEL may need to cooperate to ensure that calls are safe even when implementation code (such as a servant manager) is shared by multiple single-threaded POAs.

   These models presume that the ORB and the application are using compatible threading primitives in a multi-threaded environment.

   11.3.8.2 Lifespan Policy

   Objects with the LifespanPolicy interface are obtained using the POA::create_lifespan_policy operation and passed to the POA::create_POA operation to specify the lifespan of the objects implemented in the created POA. The following values can be supplied.

   If no LifespanPolicy object is passed to create_POA, the lifespan policy defaults to TRANSIENT.

   11.3.8.3 Object Id Uniqueness Policy

   Objects with the IdUniquenessPolicy interface are obtained using the POA::create_id_uniqueness_policy operation and passed to the POA::create_POA operation to specify whether the servants activated in the created POA must have unique object identities. The following values can be supplied.

   If no IdUniquenessPolicy is specified at POA creation, the default is UNIQUE_ID.

   Note – Use of UNIQUE_ID policy is meaningless in conjunction with NON_RETAIN policy. A conforming application should not use this policy combination. A conforming orb may, but need not, report an error during create_POA if this

   March 2004 CORBA, v3.0.3: Interfaces

   combination is used. If an orb permits this combination of policies to be used, the resulting POA shall not treat the use of the same servant for concurrent requests on different object ids as an error.

   11.3.8.4 Id Assignment Policy

   Objects with the IdAssignmentPolicy interface are obtained using the POA::create_id_assignment_policy operation and passed to the POA::create_POA operation to specify whether Object Ids in the created POA are generated by the application or by the ORB. The following values can be supplied.

   If no IdAssignmentPolicy is specified at POA creation, the default is SYSTEM_ID.

   11.3.8.5 Servant Retention Policy

   Objects with the ServantRetentionPolicy interface are obtained using the POA::create_servant_retention_policy operation and passed to the POA::create_POA operation to specify whether the created POA retains active servants in an Active Object Map. The following values can be supplied.

   If no ServantRetentionPolicy is specified at POA creation, the default is RETAIN.

   Note – The NON_RETAIN policy requires either the USE_DEFAULT_SERVANT or USE_SERVANT_MANAGER policies.

   11.3.8.6 Request Processing Policy

   Objects with the RequestProcessingPolicy interface are obtained using the POA::create_request_processing_policy operation and passed to the POA::create_POA operation to specify how requests are processed by the created POA. The following values can be supplied.

   If no RequestProcessingPolicy is specified at POA creation, the default is USE_ACTIVE_OBJECT_MAP_ONLY.

   By means of combining the USE_ACTIVE_OBJECT_MAP_ONLY / USE_DEFAULT_SERVANT / USE_SERVANT_MANAGER policies and the RETAIN / NON_RETAIN policies, the programmer is able to define a rich number of possible behaviors.

   RETAIN and USE_ACTIVE_OBJECT_MAP_ONLY

   This combination represents the situation where the POA does no automatic object activation (that is, the POA searches only the Active Object Map).

   RETAIN and USE_SERVANT_MANAGER

   This combination represents a very common situation, where there is an Active Object Map and a ServantManager.

   Because RETAIN is in effect, the application can call activate_object or activate_object_with_id to establish known servants in the Active Object Map for use in later requests.

   If the POA doesn't find a servant in the Active Object Map for a given object, it tries to determine the servant by means of invoking incarnate in the ServantManager (specifically a ServantActivator) registered with the POA. If no ServantManager is available, the POA raises the OBJ_ADAPTER system exception with standard minor code 4.

   RETAIN and USE_DEFAULT_SERVANT

   This combination represents the situation where there is a default servant defined for all requests involving unknown objects.

   Because RETAIN is in effect, the application can call activate_object or activate_object_with_id to establish known servants in the Active Object Map for use in later requests.

   The POA first tries to find a servant in the Active Object Map for a given object. If it does not find such a servant, it uses the default servant. If no default servant is available, the POA raises the OBJ_ADAPTER system exception with standard minor code 3.

   NON-RETAIN and USE_SERVANT_MANAGER

   This combination represents the situation where one servant is used per method call.

   The POA doesn't try to find a servant in the Active Object Map because the ActiveObjectMap does not exist. In every request, it will call preinvoke on the ServantManager (specifically a ServantLocator) registered with the POA. If no ServantManager is available, the POA will raise the OBJ_ADAPTER system exception.

   NON-RETAIN and USE_DEFAULT_SERVANT

   This combination represents the situation where there is one single servant defined for all CORBA objects.

   The POA does not try to find a servant in the Active Object Map because the ActiveObjectMap doesn't exist. In every request, the POA will invoke the appropriate operation on the default servant registered with the POA. If no default servant is available, the POA will raise the OBJ_ADAPTER system exception.

   11.3.8.7 Implicit Activation Policy

   Objects with the ImplicitActivationPolicy interface are obtained using the POA::create_implicit_activation_policy operation and passed to the POA::create_POA operation to specify whether implicit activation of servants is supported in the created POA. The following values can be supplied.

   If no ImplicitActivationPolicy is specified at POA creation, the default is NO_IMPLICIT_ACTIVATION.