|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.presents.server.InvocationManager
public class InvocationManager
The invocation services provide client to server invocations (service requests) and server to client invocations (responses and notifications). Via this mechanism, the client can make requests of the server, be notified of its response and the server can asynchronously invoke code on the client.
Invocations are like remote procedure calls in that they are named and take arguments. All
arguments must be Streamable objects, primitive types, or String objects. All arguments
are passed by value (by serializing and unserializing the arguments); there is no special
facility provided for referencing non-local objects (it is assumed that the distributed object
facility will already be in use for any objects that should be shared).
The server invocation manager listens for invocation requests from the client and passes them on to the invocation provider registered for the requested invocation module. It also provides a mechanism by which responses and asynchronous notification invocations can be delivered to the client.
| Nested Class Summary | |
|---|---|
protected static interface |
InvocationManager.Dispatcher
|
| Field Summary | |
|---|---|
protected Multimap<String,InvocationMarshaller<?>> |
_bootlists
Maps bootstrap group to lists of services to be provided to clients at boot time. |
protected IntMap<InvocationManager.Dispatcher> |
_dispatchers
A table of invocation dispatchers each mapped by a unique code. |
protected int |
_invCode
Used to generate monotonically increasing provider ids. |
protected int |
_invoid
The object id of the object on which we receive invocation service requests. |
protected PresentsDObjectMgr |
_omgr
The distributed object manager we're working with. |
protected Map<Integer,String> |
_recentRegServices
Tracks recently registered services so that we can complain informatively if a request comes in on a service we don't know about. |
protected Client |
_standaloneClient
A reference to the standalone client, if any. |
protected static String |
FAILED_SUFFIX
The text appended to the procedure name when generating a failure response. |
| Constructor Summary | |
|---|---|
InvocationManager(PresentsDObjectMgr omgr)
Constructs an invocation manager which will use the supplied distributed object manager to operate its invocation services. |
|
| Method Summary | ||
|---|---|---|
void |
clearDispatcher(InvocationMarshaller<?> marsh)
Clears out a dispatcher registration. |
|
protected void |
dispatchRequest(int clientOid,
int invCode,
int methodId,
Object[] args,
Transport transport)
Called when we receive an invocation request message. |
|
void |
eventReceived(DEvent event)
Called when any event has been dispatched on an object. |
|
List<InvocationMarshaller<?>> |
getBootstrapServices(String[] bootGroups)
Constructs a list of all bootstrap services registered in any of the supplied groups. |
|
Class<?> |
getDispatcherClass(int invCode)
Get the class that is being used to dispatch the specified invocation code, for informational purposes. |
|
int |
getOid()
Returns the object id of the invocation services object. |
|
protected int |
nextInvCode()
Used to generate monotonically increasing provider ids. |
|
|
registerDispatcher(InvocationDispatcher<T> dispatcher)
Registers the supplied invocation dispatcher, returning a marshaller that can be used to send requests to the provider for whom the dispatcher is proxying. |
|
|
registerDispatcher(InvocationDispatcher<T> dispatcher,
boolean bootstrap)
Deprecated. use registerDispatcher(InvocationDispatcher). |
|
|
registerDispatcher(InvocationDispatcher<T> dispatcher,
String group)
Registers the supplied invocation dispatcher, returning a marshaller that can be used to send requests to the provider for whom the dispatcher is proxying. |
|
|
registerProvider(InvocationProvider provider,
Class<T> mclass)
Registers the supplied invocation service provider. |
|
|
registerProvider(InvocationProvider provider,
Class<T> mclass,
String group)
Registers the supplied invocation service provider. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected int _invoid
protected int _invCode
@Inject(optional=true) protected Client _standaloneClient
protected PresentsDObjectMgr _omgr
protected IntMap<InvocationManager.Dispatcher> _dispatchers
protected Multimap<String,InvocationMarshaller<?>> _bootlists
protected final Map<Integer,String> _recentRegServices
protected static final String FAILED_SUFFIX
| Constructor Detail |
|---|
@Inject public InvocationManager(PresentsDObjectMgr omgr)
| Method Detail |
|---|
public int getOid()
public <T extends InvocationMarshaller<?>> T registerProvider(InvocationProvider provider,
Class<T> mclass)
provider - the provider to be registered.mclass - the class of the invocation marshaller generated for the service.
public <T extends InvocationMarshaller<?>> T registerProvider(InvocationProvider provider,
Class<T> mclass,
String group)
provider - the provider to be registered.mclass - the class of the invocation marshaller generated for the service.group - the bootstrap group in which this marshaller is to be registered, or null if it
is not a bootstrap service. Do not: register a marshaller with multiple boot
groups. You must collect shared marshaller into as fine grained a set of groups as necessary
and have different types of clients specify the list of groups they need.public <T extends InvocationMarshaller<?>> T registerDispatcher(InvocationDispatcher<T> dispatcher)
dispatcher - the dispatcher to be registered.
@Deprecated
public <T extends InvocationMarshaller<?>> T registerDispatcher(InvocationDispatcher<T> dispatcher,
boolean bootstrap)
registerDispatcher(InvocationDispatcher).
public <T extends InvocationMarshaller<?>> T registerDispatcher(InvocationDispatcher<T> dispatcher,
String group)
dispatcher - the dispatcher to be registered.group - the bootstrap group in which this marshaller is to be registered, or null if it
is not a bootstrap service. Do not: register a dispatcher with multiple boot
groups. You must collect shared dispatchers into as fine grained a set of groups as
necessary and have different types of clients specify the list of groups they need.public void clearDispatcher(InvocationMarshaller<?> marsh)
public List<InvocationMarshaller<?>> getBootstrapServices(String[] bootGroups)
public Class<?> getDispatcherClass(int invCode)
public void eventReceived(DEvent event)
EventListener
eventReceived in interface EventListenerevent - The event that was dispatched on the object.
protected void dispatchRequest(int clientOid,
int invCode,
int methodId,
Object[] args,
Transport transport)
protected int nextInvCode()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||