Previous Table of Contents Next


11.3.4 AdapterActivator Interface


   Adapter activators are associated with POAs. 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.

   While a request from the POA to an adapter activator is in progress, all requests to objects managed by the new POA (or any descendant POAs) will be queued. This serialization allows the adapter activator to complete any initialization of the new POA before requests are delivered to that POA.

   An AdapterActivator object must be local to the process containing the POA objects it is registered with. AdapterActivator is a local interface.

   11.3.4.1 unknown_adapter

   boolean unknown_adapter(in POA parent, in string name);

   This operation is invoked when the ORB receives a request for an object reference that identifies a target POA that does not exist. The ORB invokes this operation once for each POA that must be created in order for the target POA to exist (starting with the ancestor POA closest to the root POA). The operation is invoked on the adapter activator associated with the POA that is the parent of the POA that needs to be created. That parent POA is passed as the parent parameter. The name of the POA to be created (relative to the parent) is passed as the name parameter.

   The implementation of this operation should either create the specified POA and return TRUE, or it should return FALSE. If the operation returns TRUE, the ORB will proceed with processing the request. If the operation returns FALSE, the ORB will return OBJECT_NOT_EXIST with standard minor code 2 to the client. If multiple POAs need to be created, the ORB will invoke unknown_adapter once for each POA that needs to be created. If the parent of a nonexistent POA does not have an associated adapter activator, the ORB will return the OBJECT_NOT_EXIST system exception with standard minor code 2.

   If unknown_adapter raises a system exception, the ORB will report an OBJ_ADAPTER system exception with standard minor code 1.

   Note – It is possible for another thread to create the same POA the AdapterActivator is being asked to create if AdapterActivators are used in conjunction with other threads calling create_POA with the same POA name. Applications should be prepared to deal with failures from either the manual or automatic (AdapterActivator) POA creation request. There can be no guarantee of the order of such calls.

   For example, if the target object reference was created by a POA whose full name is “A,? “B,? “C,? “D? and only POAs “A? and “B? currently exist, the unknown_adapter operation will be invoked on the adapter activator associated with POA “B? passing POA “B? as the parent parameter and “C? as the name of the missing POA. Assuming that the adapter activator creates POA “C? and returns TRUE, the ORB will then invoke unknown_adapter on the adapter activator associated with POA “C,? passing POA “C? as the parent parameter and “D? as the name.

   The unknown_adapter operation is also invoked when find_POA is called on the POA with which the AdapterActivator is associated, the specified child does not exist, and the activate_it parameter to find_POA is TRUE. If unknown_adapter creates the specified POA and returns TRUE, that POA is returned from find_POA. If unknown_adapter returns FALSE then find_POA raises AdapterNonExistent. If unknown_adapter raises any system exception then find_POA passes through the system exception it gets back from unknown_adapter.

   Note – This allows the same code, the unknown_adapter implementation, to be used to initialize a POA whether that POA is created explicitly by the application or as a side-effect of processing a request. Furthermore, it makes this initialization atomic with respect to delivery of requests to the POA.