ChannelListener
public class RpcChannel extends java.lang.Object implements ChannelListener
Modifier and Type | Class | Description |
---|---|---|
static class |
RpcChannel.RpcCollector |
Class that holds all response.
|
static class |
RpcChannel.RpcCollectorKey |
Modifier and Type | Field | Description |
---|---|---|
static int |
ALL_REPLY |
|
static int |
FIRST_REPLY |
|
static int |
MAJORITY_REPLY |
|
static int |
NO_REPLY |
|
protected static StringManager |
sm |
Constructor | Description |
---|---|
RpcChannel(byte[] rpcId,
Channel channel,
RpcCallback callback) |
Create an RPC channel.
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
accept(java.io.Serializable msg,
Member sender) |
Invoked by the channel to determine if the listener will process this message or not.
|
void |
breakdown() |
|
protected void |
finalize() |
|
RpcCallback |
getCallback() |
|
Channel |
getChannel() |
|
int |
getReplyMessageOptions() |
|
byte[] |
getRpcId() |
|
void |
messageReceived(java.io.Serializable msg,
Member sender) |
Receive a message from the channel
|
Response[] |
send(Member[] destination,
java.io.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) |
equals, hashCode
protected static final StringManager sm
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, java.io.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
- Error sending messagepublic void messageReceived(java.io.Serializable msg, Member sender)
ChannelListener
messageReceived
in interface ChannelListener
msg
- Serializablesender
- - the source of the messagepublic void breakdown()
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public boolean accept(java.io.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-2019 Apache Software Foundation. All Rights Reserved.