|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jgroups.blocks.MessageDispatcher org.jgroups.blocks.RpcDispatcher
public class RpcDispatcher
This class allows a programmer to invoke remote methods in all (or single) group members and optionally wait for the return value(s). An application will typically create a channel and layer the RpcDispatcher building block on top of it, which allows it to dispatch remote methods (client role) and at the same time be called by other members (server role). This class is derived from MessageDispatcher. Is the equivalent of RpcProtocol on the application rather than protocol level.
Nested Class Summary | |
---|---|
static interface |
RpcDispatcher.Marshaller
|
Field Summary | |
---|---|
protected MethodLookup |
method_lookup
|
protected RpcDispatcher.Marshaller |
req_marshaller
Marshaller to marshall requests at the caller and unmarshal requests at the receiver(s) |
protected RpcDispatcher.Marshaller |
rsp_marshaller
Marshaller to marshal responses at the receiver(s) and unmarshal responses at the caller |
protected java.lang.Object |
server_obj
|
Fields inherited from class org.jgroups.blocks.MessageDispatcher |
---|
async_anycasts, async_multicasts, async_unicasts, channel, channel_listeners, corr, hardware_multicast_supported, local_addr, log, members, membership_listener, msg_listener, probe_handler, prot_adapter, req_handler, sync_anycasts, sync_multicasts, sync_unicasts |
Constructor Summary | |
---|---|
RpcDispatcher()
|
|
RpcDispatcher(Channel channel,
MessageListener l,
MembershipListener l2,
java.lang.Object server_obj)
|
|
RpcDispatcher(Channel channel,
java.lang.Object server_obj)
|
Method Summary | ||
---|---|---|
|
callRemoteMethod(Address dest,
MethodCall call,
RequestOptions options)
Invokes a method in a cluster member and - if blocking - returns the result |
|
|
callRemoteMethod(Address dest,
java.lang.String method_name,
java.lang.Object[] args,
java.lang.Class[] types,
RequestOptions options)
Invokes a method in a cluster member and - if blocking - returns the result |
|
|
callRemoteMethods(java.util.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). |
|
|
callRemoteMethods(java.util.Collection<Address> dests,
java.lang.String method_name,
java.lang.Object[] args,
java.lang.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). |
|
|
callRemoteMethodsWithFuture(java.util.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). |
|
|
callRemoteMethodWithFuture(Address dest,
MethodCall call,
RequestOptions options)
Invokes a method in a cluster member and - if blocking - returns the result |
|
protected void |
correlatorStarted()
|
|
RpcDispatcher.Marshaller |
getMarshaller()
|
|
MethodLookup |
getMethodLookup()
|
|
static java.lang.String |
getName()
|
|
RpcDispatcher.Marshaller |
getRequestMarshaller()
|
|
RpcDispatcher.Marshaller |
getResponseMarshaller()
|
|
java.lang.Object |
getServerObject()
|
|
java.lang.Object |
handle(Message req)
Message contains MethodCall. |
|
void |
setMarshaller(RpcDispatcher.Marshaller m)
|
|
void |
setMethodLookup(MethodLookup method_lookup)
|
|
void |
setRequestMarshaller(RpcDispatcher.Marshaller m)
|
|
void |
setResponseMarshaller(RpcDispatcher.Marshaller m)
|
|
void |
setServerObject(java.lang.Object server_obj)
|
Methods inherited from class org.jgroups.blocks.MessageDispatcher |
---|
addChannelListener, cast, castMessage, castMessageWithFuture, channelClosed, channelConnected, channelDisconnected, createRequestCorrelator, done, getChannel, getMessageListener, getProtocolAdapter, handleUpEvent, installUpHandler, removeChannelListener, sendMessage, sendMessageWithFuture, setChannel, setMembers, setMembershipListener, setMessageListener, setRequestHandler, start, stop |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.Object server_obj
protected RpcDispatcher.Marshaller req_marshaller
protected RpcDispatcher.Marshaller rsp_marshaller
protected MethodLookup method_lookup
Constructor Detail |
---|
public RpcDispatcher()
public RpcDispatcher(Channel channel, MessageListener l, MembershipListener l2, java.lang.Object server_obj)
public RpcDispatcher(Channel channel, java.lang.Object server_obj)
Method Detail |
---|
public static java.lang.String getName()
public RpcDispatcher.Marshaller getRequestMarshaller()
public void setRequestMarshaller(RpcDispatcher.Marshaller m)
public RpcDispatcher.Marshaller getResponseMarshaller()
public void setResponseMarshaller(RpcDispatcher.Marshaller m)
public RpcDispatcher.Marshaller getMarshaller()
public void setMarshaller(RpcDispatcher.Marshaller m)
public java.lang.Object getServerObject()
public void setServerObject(java.lang.Object server_obj)
public MethodLookup getMethodLookup()
public void setMethodLookup(MethodLookup method_lookup)
public <T> RspList<T> callRemoteMethods(java.util.Collection<Address> dests, java.lang.String method_name, java.lang.Object[] args, java.lang.Class[] types, RequestOptions options) throws java.lang.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 etc
java.lang.Exception
- 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(java.util.Collection<Address> dests, MethodCall method_call, RequestOptions options) throws java.lang.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 etc
java.lang.Exception
- 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> NotifyingFuture<RspList<T>> callRemoteMethodsWithFuture(java.util.Collection<Address> dests, MethodCall method_call, RequestOptions options) throws java.lang.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 etc
java.lang.Exception
- 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, java.lang.String method_name, java.lang.Object[] args, java.lang.Class[] types, RequestOptions options) throws java.lang.Exception
dest
- The target member on which to invoke the methodmethod_name
- The name of the methodargs
- The argumentstypes
- The types of the argumentsoptions
- The options (e.g. blocking, timeout etc)
java.lang.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 java.lang.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)
java.lang.Exception
- Thrown if the method invocation threw an exception, either at the caller or the calleepublic <T> NotifyingFuture<T> callRemoteMethodWithFuture(Address dest, MethodCall call, RequestOptions options) throws java.lang.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)
java.lang.Exception
- Thrown if the method invocation threw an exceptionprotected void correlatorStarted()
correlatorStarted
in class MessageDispatcher
public java.lang.Object handle(Message req) throws java.lang.Exception
handle
in interface RequestHandler
handle
in class MessageDispatcher
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |