Package org.jgroups.blocks
Class RpcDispatcher
java.lang.Object
org.jgroups.blocks.MessageDispatcher
org.jgroups.blocks.RpcDispatcher
- All Implemented Interfaces:
RequestHandler,ChannelListener
- Direct Known Subclasses:
MuxRpcDispatcher
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.
- Author:
- Bela Ban
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic interfacestatic classUsed to provide a Marshaller2 interface to a Marshaller. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final List<ChannelListener> protected MethodLookupprotected RpcDispatcher.Marshaller2Marshaller to marshall requests at the caller and unmarshal requests at the receiver(s)protected RpcDispatcher.Marshaller2Marshaller to marshal responses at the receiver(s) and unmarshal responses at the callerprotected ObjectFields inherited from class org.jgroups.blocks.MessageDispatcher
adapter, channel, corr, handler, hardware_multicast_supported, id, local_addr, log, members, membership_listener, msg_listener, prot_adapter, req_handler, transport_adapter -
Constructor Summary
ConstructorsConstructorDescriptionRpcDispatcher(PullPushAdapter adapter, Serializable id, MessageListener l, MembershipListener l2, Object server_obj) Deprecated.RpcDispatcher(Channel channel, MessageListener l, MembershipListener l2, Object server_obj) RpcDispatcher(Channel channel, MessageListener l, MembershipListener l2, Object server_obj, boolean deadlock_detection) Deprecated.RpcDispatcher(Channel channel, MessageListener l, MembershipListener l2, Object server_obj, boolean deadlock_detection, boolean concurrent_processing) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdd a new channel listener to be notified on the channel's state change.callRemoteMethod(Address dest, String method_name, Object[] args, Class[] types, int mode, long timeout) Deprecated.callRemoteMethod(Address dest, String method_name, Object[] args, Class[] types, RequestOptions options) callRemoteMethod(Address dest, String method_name, Object[] args, String[] signature, int mode, long timeout) Deprecated.callRemoteMethod(Address dest, MethodCall call) Deprecated.callRemoteMethod(Address dest, MethodCall method_call, int mode, long timeout) Deprecated.callRemoteMethod(Address dest, MethodCall method_call, int mode, long timeout, boolean oob) Deprecated.callRemoteMethod(Address dest, MethodCall call, RequestOptions options) callRemoteMethods(Collection<Address> dests, String method_name, Object[] args, Class[] types, RequestOptions options) callRemoteMethods(Collection<Address> dests, MethodCall method_call, RequestOptions options) Invokes a method in all members contained in dests (or all members if dests is null).callRemoteMethods(Vector<Address> dests, String method_name, Object[] args, Class[] types, int mode, long timeout) Deprecated.callRemoteMethods(Vector<Address> dests, String method_name, Object[] args, Class[] types, int mode, long timeout, boolean use_anycasting) Deprecated.callRemoteMethods(Vector<Address> dests, String method_name, Object[] args, Class[] types, int mode, long timeout, boolean use_anycasting, RspFilter filter) Deprecated.callRemoteMethods(Vector<Address> dests, String method_name, Object[] args, String[] signature, int mode, long timeout) Deprecated.callRemoteMethods(Vector<Address> dests, String method_name, Object[] args, String[] signature, int mode, long timeout, boolean use_anycasting) Deprecated.callRemoteMethods(Vector<Address> dests, MethodCall method_call, int mode, long timeout) Deprecated.callRemoteMethodsWithFuture(Collection<Address> dests, MethodCall method_call, RequestOptions options) callRemoteMethodsWithFuture(Vector<Address> dests, MethodCall method_call) Deprecated.callRemoteMethodsWithFuture(Vector<Address> dests, MethodCall method_call, int mode, long timeout, boolean use_anycasting, boolean oob, RspFilter filter) Deprecated.<T> NotifyingFuture<T> callRemoteMethodWithFuture(Address dest, MethodCall call) Deprecated.<T> NotifyingFuture<T> callRemoteMethodWithFuture(Address dest, MethodCall method_call, int mode, long timeout, boolean oob) Deprecated.<T> NotifyingFuture<T> callRemoteMethodWithFuture(Address dest, MethodCall call, RequestOptions options) voidchannelClosed(Channel channel) voidchannelConnected(Channel channel) voidchannelDisconnected(Channel channel) voidchannelReconnected(Address new_addr) voidprotected voidstatic StringgetName()Message contains MethodCall.booleanvoidvoidsetMethodLookup(MethodLookup method_lookup) voidvoidvoidsetServerObject(Object server_obj) Methods inherited from class org.jgroups.blocks.MessageDispatcher
cast, castMessage, castMessage, castMessage, castMessage, castMessageWithFuture, castMessageWithFuture, createRequestCorrelator, done, getChannel, getConcurrentProcessing, getDeadlockDetection, getMembers, getMessageListener, getProtocolAdapter, installUpHandler, send, sendMessage, sendMessage, sendMessageWithFuture, sendMessageWithFuture, setChannel, setConcurrentProcessing, setDeadlockDetection, setMembershipListener, setMessageListener, setRequestHandler, start, stop
-
Field Details
-
server_obj
-
req_marshaller
Marshaller to marshall requests at the caller and unmarshal requests at the receiver(s) -
rsp_marshaller
Marshaller to marshal responses at the receiver(s) and unmarshal responses at the caller -
additionalChannelListeners
-
method_lookup
-
-
Constructor Details
-
RpcDispatcher
public RpcDispatcher() -
RpcDispatcher
-
RpcDispatcher
@Deprecated public RpcDispatcher(Channel channel, MessageListener l, MembershipListener l2, Object server_obj, boolean deadlock_detection) Deprecated. -
RpcDispatcher
@Deprecated public RpcDispatcher(Channel channel, MessageListener l, MembershipListener l2, Object server_obj, boolean deadlock_detection, boolean concurrent_processing) Deprecated. -
RpcDispatcher
@Deprecated public RpcDispatcher(PullPushAdapter adapter, Serializable id, MessageListener l, MembershipListener l2, Object server_obj) Deprecated.
-
-
Method Details
-
getName
-
getRequestMarshaller
-
setRequestMarshaller
-
getResponseMarshaller
-
setResponseMarshaller
-
getMarshaller
-
setMarshaller
-
getServerObject
-
setServerObject
-
getMethodLookup
-
setMethodLookup
-
callRemoteMethods
@Deprecated public RspList callRemoteMethods(Vector<Address> dests, String method_name, Object[] args, Class[] types, int mode, long timeout) Deprecated. -
callRemoteMethods
@Deprecated public RspList callRemoteMethods(Vector<Address> dests, String method_name, Object[] args, Class[] types, int mode, long timeout, boolean use_anycasting) Deprecated. -
callRemoteMethods
@Deprecated public RspList callRemoteMethods(Vector<Address> dests, String method_name, Object[] args, Class[] types, int mode, long timeout, boolean use_anycasting, RspFilter filter) Deprecated. -
callRemoteMethods
public RspList callRemoteMethods(Collection<Address> dests, String method_name, Object[] args, Class[] types, RequestOptions options) -
callRemoteMethods
@Deprecated public RspList callRemoteMethods(Vector<Address> dests, String method_name, Object[] args, String[] signature, int mode, long timeout) Deprecated. -
callRemoteMethods
@Deprecated public RspList callRemoteMethods(Vector<Address> dests, String method_name, Object[] args, String[] signature, int mode, long timeout, boolean use_anycasting) Deprecated. -
callRemoteMethods
@Deprecated public RspList callRemoteMethods(Vector<Address> dests, MethodCall method_call, int mode, long timeout) Deprecated. -
callRemoteMethods
public RspList callRemoteMethods(Collection<Address> dests, MethodCall method_call, RequestOptions options) Invokes a method in all members contained in dests (or all members if dests is null).- Parameters:
dests- A list of addresses. If null, the method will be invoked on all cluster membersmethod_call- The method (plus args) to be invokedoptions- A collection of call options, e.g. sync versus async, timeout etc- Returns:
- RspList A list of return values and flags (suspected, not received) per member
- Since:
- 2.9
-
callRemoteMethodsWithFuture
@Deprecated public NotifyingFuture<RspList> callRemoteMethodsWithFuture(Vector<Address> dests, MethodCall method_call, int mode, long timeout, boolean use_anycasting, boolean oob, RspFilter filter) Deprecated. -
callRemoteMethodsWithFuture
@Deprecated public NotifyingFuture<RspList> callRemoteMethodsWithFuture(Vector<Address> dests, MethodCall method_call) Deprecated. -
callRemoteMethodsWithFuture
public NotifyingFuture<RspList> callRemoteMethodsWithFuture(Collection<Address> dests, MethodCall method_call, RequestOptions options) -
callRemoteMethod
@Deprecated public Object callRemoteMethod(Address dest, String method_name, Object[] args, Class[] types, int mode, long timeout) throws Throwable Deprecated.- Throws:
Throwable
-
callRemoteMethod
public Object callRemoteMethod(Address dest, String method_name, Object[] args, Class[] types, RequestOptions options) throws Throwable - Throws:
Throwable
-
callRemoteMethod
@Deprecated public Object callRemoteMethod(Address dest, String method_name, Object[] args, String[] signature, int mode, long timeout) throws Throwable Deprecated.- Throws:
Throwable
-
callRemoteMethod
@Deprecated public Object callRemoteMethod(Address dest, MethodCall method_call, int mode, long timeout) throws Throwable Deprecated.- Throws:
Throwable
-
callRemoteMethod
@Deprecated public Object callRemoteMethod(Address dest, MethodCall method_call, int mode, long timeout, boolean oob) throws Throwable Deprecated.- Throws:
Throwable
-
callRemoteMethod
Deprecated.- Throws:
Throwable
-
callRemoteMethod
public Object callRemoteMethod(Address dest, MethodCall call, RequestOptions options) throws Throwable - Throws:
Throwable
-
callRemoteMethodWithFuture
@Deprecated public <T> NotifyingFuture<T> callRemoteMethodWithFuture(Address dest, MethodCall method_call, int mode, long timeout, boolean oob) throws Throwable Deprecated.- Throws:
Throwable
-
callRemoteMethodWithFuture
@Deprecated public <T> NotifyingFuture<T> callRemoteMethodWithFuture(Address dest, MethodCall call) throws Throwable Deprecated.- Throws:
Throwable
-
callRemoteMethodWithFuture
public <T> NotifyingFuture<T> callRemoteMethodWithFuture(Address dest, MethodCall call, RequestOptions options) throws Throwable - Throws:
Throwable
-
correlatorStarted
protected void correlatorStarted()- Overrides:
correlatorStartedin classMessageDispatcher
-
handle
Message contains MethodCall. Execute it against *this* object and return result. Use MethodCall.invoke() to do this. Return result.- Specified by:
handlein interfaceRequestHandler- Overrides:
handlein classMessageDispatcher
-
addChannelListener
Add a new channel listener to be notified on the channel's state change.- Returns:
- true if the listener was added or false if the listener was already in the list.
-
removeChannelListener
- Returns:
- true if the channel was removed indeed.
-
channelConnected
- Specified by:
channelConnectedin interfaceChannelListener
-
channelDisconnected
- Specified by:
channelDisconnectedin interfaceChannelListener
-
channelClosed
- Specified by:
channelClosedin interfaceChannelListener
-
channelShunned
public void channelShunned()- Specified by:
channelShunnedin interfaceChannelListener
-
channelReconnected
- Specified by:
channelReconnectedin interfaceChannelListener
-