org.jgroups.blocks

Class RpcDispatcher

public class RpcDispatcher extends MessageDispatcher implements ChannelListener

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
interfaceRpcDispatcher.Marshaller
Field Summary
protected ListadditionalChannelListeners
protected RpcDispatcher.Marshallermarshaller
protected MethodLookupmethod_lookup
protected Objectserver_obj
Constructor Summary
RpcDispatcher(Channel channel, MessageListener l, MembershipListener l2, Object server_obj)
RpcDispatcher(Channel channel, MessageListener l, MembershipListener l2, Object server_obj, boolean deadlock_detection)
RpcDispatcher(Channel channel, MessageListener l, MembershipListener l2, Object server_obj, boolean deadlock_detection, boolean concurrent_processing)
RpcDispatcher(PullPushAdapter adapter, Serializable id, MessageListener l, MembershipListener l2, Object server_obj)
Method Summary
booleanaddChannelListener(ChannelListener l)
Add a new channel listener to be notified on the channel's state change.
ObjectcallRemoteMethod(Address dest, String method_name, Object[] args, Class[] types, int mode, long timeout)
ObjectcallRemoteMethod(Address dest, String method_name, Object[] args, String[] signature, int mode, long timeout)
ObjectcallRemoteMethod(Address dest, MethodCall method_call, int mode, long timeout)
RspListcallRemoteMethods(Vector dests, String method_name, Object[] args, Class[] types, int mode, long timeout)
RspListcallRemoteMethods(Vector dests, String method_name, Object[] args, String[] signature, int mode, long timeout)
RspListcallRemoteMethods(Vector dests, MethodCall method_call, int mode, long timeout)
RspListcastMessage(Vector dests, Message msg, int mode, long timeout)
voidchannelClosed(Channel channel)
voidchannelConnected(Channel channel)
voidchannelDisconnected(Channel channel)
voidchannelReconnected(Address new_addr)
voidchannelShunned()
RpcDispatcher.MarshallergetMarshaller()
MethodLookupgetMethodLookup()
StringgetName()
ObjectgetServerObject()
Objecthandle(Message req)
Message contains MethodCall.
booleanremoveChannelListener(ChannelListener l)
ObjectsendMessage(Message msg, int mode, long timeout)
voidsetMarshaller(RpcDispatcher.Marshaller m)
voidsetMethodLookup(MethodLookup method_lookup)

Field Detail

additionalChannelListeners

protected List additionalChannelListeners

marshaller

protected RpcDispatcher.Marshaller marshaller

method_lookup

protected MethodLookup method_lookup

server_obj

protected Object server_obj

Constructor Detail

RpcDispatcher

public RpcDispatcher(Channel channel, MessageListener l, MembershipListener l2, Object server_obj)

RpcDispatcher

public RpcDispatcher(Channel channel, MessageListener l, MembershipListener l2, Object server_obj, boolean deadlock_detection)

RpcDispatcher

public RpcDispatcher(Channel channel, MessageListener l, MembershipListener l2, Object server_obj, boolean deadlock_detection, boolean concurrent_processing)

RpcDispatcher

public RpcDispatcher(PullPushAdapter adapter, Serializable id, MessageListener l, MembershipListener l2, Object server_obj)

Method Detail

addChannelListener

public boolean addChannelListener(ChannelListener l)
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.

callRemoteMethod

public Object callRemoteMethod(Address dest, String method_name, Object[] args, Class[] types, int mode, long timeout)

callRemoteMethod

public Object callRemoteMethod(Address dest, String method_name, Object[] args, String[] signature, int mode, long timeout)

callRemoteMethod

public Object callRemoteMethod(Address dest, MethodCall method_call, int mode, long timeout)

callRemoteMethods

public RspList callRemoteMethods(Vector dests, String method_name, Object[] args, Class[] types, int mode, long timeout)

callRemoteMethods

public RspList callRemoteMethods(Vector dests, String method_name, Object[] args, String[] signature, int mode, long timeout)

callRemoteMethods

public RspList callRemoteMethods(Vector dests, MethodCall method_call, int mode, long timeout)

castMessage

public RspList castMessage(Vector dests, Message msg, int mode, long timeout)

channelClosed

public void channelClosed(Channel channel)

channelConnected

public void channelConnected(Channel channel)

channelDisconnected

public void channelDisconnected(Channel channel)

channelReconnected

public void channelReconnected(Address new_addr)

channelShunned

public void channelShunned()

getMarshaller

public RpcDispatcher.Marshaller getMarshaller()

getMethodLookup

public MethodLookup getMethodLookup()

getName

public String getName()

getServerObject

public Object getServerObject()

handle

public Object handle(Message req)
Message contains MethodCall. Execute it against *this* object and return result. Use MethodCall.invoke() to do this. Return result.

removeChannelListener

public boolean removeChannelListener(ChannelListener l)

Returns: true if the channel was removed indeed.

sendMessage

public Object sendMessage(Message msg, int mode, long timeout)

setMarshaller

public void setMarshaller(RpcDispatcher.Marshaller m)

setMethodLookup

public void setMethodLookup(MethodLookup method_lookup)
Copyright ? 1998-2005 Bela Ban. All Rights Reserved.