Thread policy The thread policy specifies the threading model to be used by the POA.
ORB_CTRL_MODEL: (Default) The POA is responsible for assigning requests to threads. In a multi-threaded environment, concurrent requests may be delivered using multiple threads. Note that VisiBroker uses multi-threading model.
SINGLE_THREAD_MODEL: The POA processes requests sequentially. In a multi-threaded environment, all calls made by the POA to servants and servant managers are thread-safe.
MAIN_THREAD_MODEL: Calls are processed on a distinguished “main” thread. Requests for all main-thread POAs are processed sequentially. In a multi-threaded environment, all calls processed by all POAs with this policy are thread-safe. The application programmer designates the main thread by calling ORB::run() or ORB::perform_work(). For more information about these methods, see
“Activating objects”.
Lifespan policy The lifespan policy specifies the lifespan of the objects implemented in the POA.
TRANSIENT: (Default) A transient object activated by a POA cannot outlive the POA that created it. Once the POA is deactivated, an OBJECT_NOT_EXIST exception occurs if an attempt is made to use any object references generated by the POA.
PERSISTENT: A persistent object activated by a POA can outlive the process in which it was first created. Requests invoked on a persistent object may result in the implicit activation of a process, a POA and the servant that implements the object.
Object ID Uniqueness policy The Object ID Uniqueness policy allows a single servant to be shared by many abstract objects.
UNIQUE_ID: (Default) Activated servants support only one Object ID.
MULTIPLE_ID: Activated servants can have one or more Object IDs. The Object ID must be determined within the method being invoked at run time.
ID Assignment policy The ID assignment policy specifies whether object IDs are generated by server applications or by the POA.
USER_ID: Objects are assigned object IDs by the application.
SYSTEM_ID: (Default) Objects are assigned object IDs by the POA. If the PERSISTENT policy is also set, object IDs must be unique across all instantiations of the same POA.
Servant Retention policy The Servant Retention policy specifies whether the POA retains active servants in the Active Object Map.
RETAIN: (Default) The POA tracks object activations in the Active Object Map. RETAIN is usually used with ServantActivators or explicit activation methods on POA.
NON_RETAIN: The POA does not retain active servants in the Active Object Map. NON_RETAIN must be used with ServantLocators.
Request Processing policy The Request Processing policy specifies how requests are processed by the POA.
USE_ACTIVE_OBJECT_MAP_ONLY: (Default) If the Object ID is not listed in the Active Object Map, an OBJECT_NOT _EXIST exception is returned. The POA must also use the RETAIN policy with this value.
USE_DEFAULT_SERVANT: If the Object ID is not listed in the Active Object Map or the NON_RETAIN policy is set, the request is dispatched to the default servant. If no default servant has been registered, an OBJ_ADAPTER exception is returned. The POA must also use the MULTIPLE_ID policy with this value.
USE_SERVANT_MANAGER: If the Object ID is not listed in the Active Object Map or the NON_RETAIN policy is set, the servant manager is used to obtain a servant.
Implicit Activation policy The Implicit Activation policy specifies whether the POA supports implicit activation of servants.
IMPLICIT_ACTIVATION: The POA supports implicit activation of servants. There are two ways to activate the servants as follows:
NO_IMPLICIT_ACTIVATION: (Default) The POA does not support implicit activation of servants.
Bind Support policy The Bind Support policy (a VisiBroker-specific policy) controls the registration of POAs and active objects with the VisiBroker osagent. If you have several thousands of objects, it is not feasible to register all of them with the osagent. Instead, you can register the POA with the osagent. When a client request is made, the POA name and the object ID is included in the bind request so that the osagent can correctly forward the request.
BY_INSTANCE: All active objects are registered with the osagent. The POA must also use the PERSISTENT and RETAIN policy with this value.
BY_POA: (Default) Only POAs are registered with the osagent. The POA must also use the PERSISTENT policy with this value.
NONE: Neither POAs nor active objects are registered with the smart agent.
Each POA keeps track of its name and its full POA name (the full hierarchical path name.) The hierarchy is indicated by a slash (/). For example, /A/B/C means that POA C is a child of POA B, which in turn is a child of POA A. The first slash (see the previous example) indicates the rootPOA. If the BindSupport:BY_POA policy is set on POA C, then
/A/B/C is registered with the osagent and the client binds with
/A/B/C.
The resolve_initial_references method returns a value of type
CORBA::Object. You are responsible for narrowing the returned object reference to the desired type, which is
PortableServer::POA in the previous example.
A POA is created using create_POA on its parent POA. You can name the POA anything you like; however, the name must be unique with respect to all other POAs with the same parent. If you attempt to give two POAs the same name, a CORBA exception (
AdapterAlreadyExists) is raised.
The POA manager controls the state of the POA (for example, whether it is processing requests). If null is passed to
create_POA as the POA manager name, a new POA manager object is created and associated with the POA. Typically, you will want to have the same POA manager for all POAs. For more information about the POA manager, see
“Managing POAs with the POA manager”.
POA managers (and POAs) are not automatically activated once created. Use activate() to activate the POA manager associated with your POA. The following code sample is an example of creating a POA.
By setting IdAssignmentPolicy::SYSTEM_ID on a POA, objects can be explicitly activated without having to specify an object ID. The server invokes
activate_object on the POA which activates, assigns and returns an object ID for the object. This type of activation is most common for transient objects. No servant manager is required since neither the object nor the servant is needed for very long.
Objects can also be explicitly activated using object IDs. A common scenario is during server initialization where the user invokes activate_object_with_id to activate all the objects managed by the server. No servant manager is required since all the objects are already activated. If a request for a non-existent object is received, an
OBJECT_NOT_EXIST exception is raised. This has obvious negative effects if your server manages large numbers of objects.
The POA policies determine any additional steps that may occur. For example, if RequestProcessingPolicy::USE_SERVANT_MANAGER and
ServantRetentionPolicy::RETAIN are enabled, the Active Object Map is updated with the servant and object ID association.
A servant can be implicitly activated by certain operations if the POA has been created with ImplicitActivationPolicy::IMPLICIT_ACTIVATION,
IdAssignmentPolicy::SYSTEM_ID, and
ServantRetentionPolicy::RETAIN. Implicit activation can occur with:
If the POA has IdUniquenessPolicy::UNIQUE_ID set, implicit activation can occur when any of the above operations are performed on an inactive servant.
If the POA has IdUniquenessPolicy::MULTIPLE_ID set,
servant_to_reference and
servant_to_id operations always perform implicit activation, even if the servant is already active.
Use the RequestProcessing::USE_DEFAULT_SERVANT policy to have the POA invoke the same servant no matter what the object ID is. This is useful when little data is associated with each object.
There are two types of servant managers: ServantActivator and
ServantLocator. The type of policy already in place determines which type of servant manager is used. For more information on POA policy, see
“POA policies”. Typically, a Servant Activator activates persistent objects and a Servant Locator activates transient objects.
To use servant managers, RequestProcessingPolicy::USE_SERVANT_MANAGER must be set as well as the policy which defines the type of servant manager (
ServantRetentionPolicy::RETAIN for Servant Activator or
ServantRetentionPolicy::NON_RETAIN for Servant Locator.)
The etherealize and
incarnate method implementations are user-supplied code.
At a later date, the servant can be deactivated. This may occur from several sources, including the deactivate_object operation, deactivation of the POA manager associated with that POA, and so forth. More information on deactivating objects is described in
“Deactivating objects”.
In many situations, the POA's Active Object Map could become quite large and consume memory. To reduce memory consumption, a POA can be created with RequestProcessingPolicy::USE_SERVANT_MANAGER and
ServantRetentionPolicy::.NON_RETAIN, meaning that the servant-to-object association is not stored in the active object map. Since no association is stored,
ServantLocator servant managers are invoked for each request.
The preinvoke and
postinvoke methods are user-supplied code.
wait_for_completion is
Boolean. If
FALSE, this operation returns immediately after changing the state to holding. If
TRUE, this operation returns only when all requests started prior to the state change have completed or when the POA manager is changed to a state other than holding.
AdapterInactive is the exception raised if the POA manager was in the inactive state prior to calling this operation.
AdapterInactive is the exception raised if the POA manager was in the inactive state prior to calling this operation.
The wait_for_completion option is Boolean. If
FALSE, this operation returns immediately after changing the state to holding. If
TRUE, this operation returns only when all requests started prior to the state change have completed or when the POA manager is changed to a state other than discarding.
AdapterInactive is the exception raised if the POA manager was in the inactive state prior to calling this operation.
After the state changes, if etherealize_objects is
TRUE, then all associated POAs that have
Servant RetentionPolicy::RETAIN and
RequestProcessingPolicy::USE_SERVANT_MANAGER set call
etherealize on the servant manager for all active objects. If
etherealize_objects is
FALSE, then
etherealize is not called. The
wait_for_completion option is Boolean. If
FALSE, this operation returns immediately after changing the state to inactive. If
TRUE, this operation returns only when all requests started prior to the state change have completed or etherealize has been called on all associated POAs (that have
ServantRetentionPolicy::RETAIN and
RequestProcessingPolicy::USE_SERVANT_MANAGER).
AdapterInactive is the exception raised if the POA manager was in the inactive state prior to calling this operation.
defines a new server engine with the name MySE. Root POA and all child POAs created will be associated with this Server Engine by default.
To change the default server engine policy, enter its name using the vbroker.se.default property and define the values for all the components of the new server engine. For example:
The proxyHost property can also take an IP address as its value. Doing so replaces the default hostname in the IOR with this IP address.
the iiop_tp and
liop_tp Server Engines have SCMs named iiop_tp and liop_tp created for them, respectively.
Additionally, VisiBroker for C++ defines another manager of type Local. The
Local type corresponds to
Local IPC connections, while the
Socket manager type expects TCP connections. To select either
Local or
Socket, set the following property:
Setting connectionMax to
0 (zero) indicates that there is no restriction on the number of connections, which is the default setting.
Setting connectionMaxIdle to
0 (zero) indicates that there is no timeout, which is the default setting.
Garbage collection time can also be specified for the manager to garbage-collect idled connections. (Connections can idle after the connectionMaxIdle time until they are garbage-collected.) You can use the
garbageCollectTimer property to specify the period of garbage collection in seconds:
A value of 0 (zero) means that the connection will never be garbage collected.
For systems using shared memory Local IPC, the shmSize property is used to control the shared memory size, in bytes:
If you do not set the port property (or set it to 0 [zero]), a random port will be selected. A
0 value for the
proxyPort property means that the IOR will contain the actual port (defined by the
listener.port property or selected by the system randomly). If it is not required to advertise the actual port, set the proxy port to a non-zero (positive) value.
Changing the default listener.port property is the simplest method, but this affects all POAs that use the default server engine. This may or may not be what you want.
An adapter activator supplies a POA with the ability to create child POAs on demand, as a side-effect of receiving a request that names the child POA (or one of its children), or when find_POA is called with an activate parameter value of TRUE. An application server that creates all its needed POAs at the beginning of execution does not need to use or provide an adapter activator; it is necessary only for the case in which POAs need to be created during request processing.