public class RpcDispatcher extends MessageDispatcher
Modifier and Type | Field and Description |
---|---|
protected Marshaller |
marshaller
Marshaller to marshall requests at the caller, unmarshal requests at the receiver(s), marshall responses at the
receivers and unmarshall responses at the caller
|
protected MethodLookup |
method_lookup |
protected Object |
server_obj |
async_dispatching, channel, corr, empty_group_request, empty_rsplist, local_addr, log, members, membership_listener, prot_adapter, req_handler, rpc_stats, state_listener, wrap_exceptions
Constructor and Description |
---|
RpcDispatcher() |
RpcDispatcher(JChannel channel,
Object server_obj) |
Modifier and Type | Method and Description |
---|---|
<T> T |
callRemoteMethod(Address dest,
MethodCall call,
RequestOptions options)
Invokes a method in a cluster member and - if blocking - returns the result
|
<T> T |
callRemoteMethod(Address dest,
String meth,
Object[] args,
Class[] types,
RequestOptions opts)
Invokes a method in a cluster member and - if blocking - returns the result
|
<T> RspList<T> |
callRemoteMethods(Collection<Address> dests,
MethodCall method_call,
RequestOptions opts)
Invokes a method in all members and expects responses from members contained in dests (or all members if dests is null).
|
<T> RspList<T> |
callRemoteMethods(Collection<Address> dests,
String method_name,
Object[] args,
Class[] types,
RequestOptions options)
Invokes a method in all members and expects responses from members contained in dests (or all members if dests is null).
|
<T> CompletableFuture<RspList<T>> |
callRemoteMethodsWithFuture(Collection<Address> dests,
MethodCall method_call,
RequestOptions options)
Invokes a method in all members and expects responses from members contained in dests (or all members if dests is null).
|
<T> CompletableFuture<T> |
callRemoteMethodWithFuture(Address dest,
MethodCall call,
RequestOptions opts)
Invokes a method in a cluster member and - if blocking - returns the result
|
protected void |
correlatorStarted() |
Marshaller |
getMarshaller() |
MethodLookup |
getMethodLookup() |
Object |
getServerObject() |
Object |
handle(Message req)
Message contains MethodCall.
|
protected static MethodCall |
methodCallFromBuffer(byte[] buf,
int offset,
int length,
Marshaller marshaller) |
protected static Buffer |
methodCallToBuffer(MethodCall call,
Marshaller marshaller) |
RpcDispatcher |
setMarshaller(Marshaller m) |
RpcDispatcher |
setMembershipListener(MembershipListener l) |
RpcDispatcher |
setMethodLookup(MethodLookup method_lookup) |
RpcDispatcher |
setServerObject(Object server_obj) |
asyncDispatching, asyncDispatching, cast, cast, castMessage, castMessage, castMessageWithFuture, channelClosed, channelConnected, channelDisconnected, close, correlator, correlator, createRequestCorrelator, done, extendedStats, extendedStats, getAsyncDispatching, getChannel, getCorrelator, getExtendedStats, getProtocolAdapter, getRpcStats, getWrapExceptions, handle, handleUpEvent, installUpHandler, protocolAdapter, rpcStats, sendMessage, sendMessage, sendMessageWithFuture, sendMessageWithFuture, setAsynDispatching, setChannel, setCorrelator, setExtendedStats, setMembers, setRequestHandler, setStateListener, setWrapExceptions, start, stop, updateStats, wrapExceptions, wrapExceptions
protected Object server_obj
protected Marshaller marshaller
protected MethodLookup method_lookup
public Marshaller getMarshaller()
public RpcDispatcher setMarshaller(Marshaller m)
public Object getServerObject()
public RpcDispatcher setServerObject(Object server_obj)
public RpcDispatcher setMembershipListener(MembershipListener l)
setMembershipListener
in class MessageDispatcher
public MethodLookup getMethodLookup()
public RpcDispatcher setMethodLookup(MethodLookup method_lookup)
public <T> RspList<T> callRemoteMethods(Collection<Address> dests, String method_name, Object[] args, Class[] types, RequestOptions options) throws Exception
dests
- A list of addresses. If null, we'll wait for responses from all cluster membersmethod_name
- The name of the target methodargs
- The arguments to be passedtypes
- The types of the argumentsoptions
- A collection of call options, e.g. sync versus async, timeout etcException
- If the sending of the message threw an exception. Note that no exception will be
thrown if any of the target members threw an exception, but this exception will be in the Rsp
object for the particular member in the RspListpublic <T> RspList<T> callRemoteMethods(Collection<Address> dests, MethodCall method_call, RequestOptions opts) throws Exception
dests
- A list of addresses. If null, we'll wait for responses from all cluster membersmethod_call
- The method (plus args) to be invokedopts
- A collection of call options, e.g. sync versus async, timeout etcException
- If the sending of the message threw an exception. Note that no exception will be
thrown if any of the target members threw an exception, but this exception will be in the Rsp
object for the particular member in the RspListpublic <T> CompletableFuture<RspList<T>> callRemoteMethodsWithFuture(Collection<Address> dests, MethodCall method_call, RequestOptions options) throws Exception
dests
- A list of addresses. If null, we'll wait for responses from all cluster membersmethod_call
- The method (plus args) to be invokedoptions
- A collection of call options, e.g. sync versus async, timeout etcException
- If the sending of the message threw an exception. Note that no exception will be
thrown if any of the target members threw an exception; such an exception will be in the Rsp
element for the particular member in the RspListpublic <T> T callRemoteMethod(Address dest, String meth, Object[] args, Class[] types, RequestOptions opts) throws Exception
dest
- The target member on which to invoke the methodmeth
- The name of the methodargs
- The argumentstypes
- The types of the argumentsopts
- The options (e.g. blocking, timeout etc)Exception
- Thrown if the method invocation threw an exception, either at the caller or the calleepublic <T> T callRemoteMethod(Address dest, MethodCall call, RequestOptions options) throws Exception
dest
- The target member on which to invoke the methodcall
- The call to be invoked, including method are argumentsoptions
- The options (e.g. blocking, timeout etc)Exception
- Thrown if the method invocation threw an exception, either at the caller or the calleepublic <T> CompletableFuture<T> callRemoteMethodWithFuture(Address dest, MethodCall call, RequestOptions opts) throws Exception
dest
- The target member on which to invoke the methodcall
- The call to be invoked, including method are argumentsopts
- The options (e.g. blocking, timeout etc)Exception
- Thrown if the method invocation threw an exceptionpublic Object handle(Message req) throws Exception
handle
in interface RequestHandler
handle
in class MessageDispatcher
req
- the message containing the requestException
protected static Buffer methodCallToBuffer(MethodCall call, Marshaller marshaller) throws Exception
Exception
protected static MethodCall methodCallFromBuffer(byte[] buf, int offset, int length, Marshaller marshaller) throws Exception
Exception
protected void correlatorStarted()
correlatorStarted
in class MessageDispatcher
Copyright © 2018 JBoss, a division of Red Hat. All rights reserved.