public interface ObjectAdapter
Object adapters must also provide mechanisms for:
The basic function of an ObjectAdapter is to map object IDs to servants and to support the dispatch operation of the subcontract, which dispatches requests to servants. This is the purpose of the getInvocationServant method. In addition, ObjectAdapters must be able to change state gracefully in the presence of executing methods. This requires the use of the enter/exit methods. Finally, ObjectAdapters often require access to information about requests. This is accomodated through the OAInvocationInfo class and the thread local stack maintained by push/pop/peekInvocationInfo on the ORB.
To be useful, this dispatch cycle must be extremely efficient. There are several scenarios that matter:
Each of these 3 cases is handled a bit differently. On each request, assume as known ObjectId and ObjectAdapterId, which can be obtained from the object key. The ObjectAdaptorFactory is available in the subcontract registry, where it is registered under the subcontract ID. The Subcontract ID is also available in the object key.
Then, on each invocation:
Modifier and Type | Method and Description |
---|---|
void |
enter()
enter must be called before each request is invoked on a servant.
|
void |
exit()
exit must be called after each request has been completed.
|
ObjectReferenceTemplate |
getAdapterTemplate() |
ObjectReferenceFactory |
getCurrentFactory() |
Policy |
getEffectivePolicy(int type) |
String[] |
getInterfaces(Object servant,
byte[] objectId)
Return the most derived interface for the given servant and objectId.
|
void |
getInvocationServant(OAInvocationInfo info)
Get the servant for the request given by the parameters.
|
IORTemplate |
getIORTemplate()
Returns the IOR template of this adapter.
|
Object |
getLocalServant(byte[] objectId)
Get the servant corresponding to the given objectId, if this is supported.
|
int |
getManagerId()
Return the ID of the AdapterManager for this object adapter.
|
ORB |
getORB()
Returns the ORB associated with this adapter.
|
short |
getState()
Return the current state of this object adapter (see
org.omg.PortableInterceptors for states.
|
OAInvocationInfo |
makeInvocationInfo(byte[] objectId)
Create an instance of InvocationInfo that is appropriate for this
Object adapter.
|
void |
returnServant()
Must be called every time getInvocationServant is called after
the request has completed.
|
void |
setCurrentFactory(ObjectReferenceFactory factory)
Change the current factory.
|
ORB getORB()
Policy getEffectivePolicy(int type)
IORTemplate getIORTemplate()
int getManagerId()
short getState()
ObjectReferenceTemplate getAdapterTemplate()
ObjectReferenceFactory getCurrentFactory()
void setCurrentFactory(ObjectReferenceFactory factory)
Object getLocalServant(byte[] objectId)
void getInvocationServant(OAInvocationInfo info)
info
- is the InvocationInfo object for the object referenceForwardException
- (a runtime exception) is thrown if the request
is to be handled by a different object reference.void enter() throws OADestroyed
OADestroyed
- is thrown when an OA has been destroyed, which
requires a retry in the case where an AdapterActivator is present.void exit()
void returnServant()
OAInvocationInfo makeInvocationInfo(byte[] objectId)
Copyright © 2021 JBoss by Red Hat. All rights reserved.