Package org.apache.catalina.tribes.group
Class RpcChannel
java.lang.Object
org.apache.catalina.tribes.group.RpcChannel
- All Implemented Interfaces:
ChannelListener
A channel to handle RPC messaging
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Class that holds all response.static class
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
protected static final StringManager
-
Constructor Summary
ConstructorDescriptionRpcChannel
(byte[] rpcId, Channel channel, RpcCallback callback) Create an RPC channel. -
Method Summary
Modifier and TypeMethodDescriptionboolean
accept
(Serializable msg, Member sender) Invoked by the channel to determine if the listener will process this message or not.void
int
byte[]
getRpcId()
void
messageReceived
(Serializable msg, Member sender) Receive a message from the channelResponse[]
send
(Member[] destination, Serializable message, int rpcOptions, int channelOptions, long timeout) Send a message and wait for the response.void
setCallback
(RpcCallback callback) void
setChannel
(Channel channel) void
setReplyMessageOptions
(int replyMessageOptions) void
setRpcId
(byte[] rpcId)
-
Field Details
-
sm
-
FIRST_REPLY
public static final int FIRST_REPLY- See Also:
-
MAJORITY_REPLY
public static final int MAJORITY_REPLY- See Also:
-
ALL_REPLY
public static final int ALL_REPLY- See Also:
-
NO_REPLY
public static final int NO_REPLY- See Also:
-
-
Constructor Details
-
RpcChannel
Create an RPC channel. You can have several RPC channels attached to a group all separated out by the uniqueness- Parameters:
rpcId
- - the unique Id for this RPC groupchannel
- Channelcallback
- RpcCallback
-
-
Method Details
-
send
public Response[] send(Member[] destination, Serializable message, int rpcOptions, int channelOptions, long timeout) throws ChannelException Send a message and wait for the response.- Parameters:
destination
- Member[] - the destination for the message, and the members you request a reply frommessage
- Serializable - the message you are sending outrpcOptions
- int - FIRST_REPLY, MAJORITY_REPLY or ALL_REPLYchannelOptions
- channel sender optionstimeout
- long - timeout in milliseconds, if no reply is received within this time null is returned- Returns:
- Response[] - an array of response objects.
- Throws:
ChannelException
- Error sending message
-
messageReceived
Description copied from interface:ChannelListener
Receive a message from the channel- Specified by:
messageReceived
in interfaceChannelListener
- Parameters:
msg
- Serializablesender
- - the source of the message
-
breakdown
public void breakdown() -
accept
Description copied from interface:ChannelListener
Invoked by the channel to determine if the listener will process this message or not.- Specified by:
accept
in interfaceChannelListener
- Parameters:
msg
- Serializablesender
- Member- Returns:
- boolean
-
getChannel
-
getCallback
-
getRpcId
public byte[] getRpcId() -
setChannel
-
setCallback
-
setRpcId
public void setRpcId(byte[] rpcId) -
getReplyMessageOptions
public int getReplyMessageOptions() -
setReplyMessageOptions
public void setReplyMessageOptions(int replyMessageOptions)
-