public class RpcChannel extends Object implements ChannelListener
Modifier and Type | Class and Description |
---|---|
static class |
RpcChannel.RpcCollector
Class that holds all response.
|
static class |
RpcChannel.RpcCollectorKey |
Modifier and Type | Field and Description |
---|---|
static int |
ALL_REPLY |
static int |
FIRST_REPLY |
static int |
MAJORITY_REPLY |
static int |
NO_REPLY |
Constructor and Description |
---|
RpcChannel(byte[] rpcId,
Channel channel,
RpcCallback callback)
Create an RPC channel.
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(Serializable msg,
Member sender)
Invoked by the channel to determine if the listener will process this message or not.
|
void |
breakdown() |
void |
finalize() |
RpcCallback |
getCallback() |
Channel |
getChannel() |
int |
getReplyMessageOptions() |
byte[] |
getRpcId() |
void |
messageReceived(Serializable msg,
Member sender)
Receive a message from the channel
|
Response[] |
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) |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
equals, hashCode
public static final int FIRST_REPLY
public static final int MAJORITY_REPLY
public static final int ALL_REPLY
public static final int NO_REPLY
public RpcChannel(byte[] rpcId, Channel channel, RpcCallback callback)
rpcId
- - the unique Id for this RPC groupchannel
- Channelcallback
- RpcCallbackpublic Response[] send(Member[] destination, Serializable message, int rpcOptions, int channelOptions, long timeout) throws ChannelException
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 returnedChannelException
public void messageReceived(Serializable msg, Member sender)
ChannelListener
messageReceived
in interface ChannelListener
msg
- Serializablesender
- - the source of the messagepublic void breakdown()
public void finalize() throws Throwable
public boolean accept(Serializable msg, Member sender)
ChannelListener
accept
in interface ChannelListener
msg
- Serializablesender
- Memberpublic Channel getChannel()
public RpcCallback getCallback()
public byte[] getRpcId()
public void setChannel(Channel channel)
public void setCallback(RpcCallback callback)
public void setRpcId(byte[] rpcId)
public int getReplyMessageOptions()
public void setReplyMessageOptions(int replyMessageOptions)
Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.