org.apache.catalina.tribes.group

Class RpcChannel

public class RpcChannel extends Object implements ChannelListener

A channel to handle RPC messaging

Author: Filip Hanik

Nested Class Summary
static classRpcChannel.RpcCollector
Class that holds all response.
static classRpcChannel.RpcCollectorKey
Field Summary
static intALL_REPLY
static intFIRST_REPLY
protected static Loglog
static intMAJORITY_REPLY
static intNO_REPLY
Constructor Summary
RpcChannel(byte[] rpcId, Channel channel, RpcCallback callback)
Create an RPC channel.
Method Summary
booleanaccept(Serializable msg, Member sender)
voidbreakdown()
protected static StringbToS(byte[] data)
voidfinalize()
RpcCallbackgetCallback()
ChannelgetChannel()
byte[]getRpcId()
voidmessageReceived(Serializable msg, Member sender)
Response[]send(Member[] destination, Serializable message, int rpcOptions, int channelOptions, long timeout)
Send a message and wait for the response.
voidsetCallback(RpcCallback callback)
voidsetChannel(Channel channel)
voidsetRpcId(byte[] rpcId)

Field Detail

ALL_REPLY

public static final int ALL_REPLY

FIRST_REPLY

public static final int FIRST_REPLY

log

protected static Log log

MAJORITY_REPLY

public static final int MAJORITY_REPLY

NO_REPLY

public static final int NO_REPLY

Constructor Detail

RpcChannel

public RpcChannel(byte[] rpcId, Channel channel, RpcCallback callback)
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 group channel Channel callback RpcCallback

Method Detail

accept

public boolean accept(Serializable msg, Member sender)

breakdown

public void breakdown()

bToS

protected static String bToS(byte[] data)

finalize

public void finalize()

getCallback

public RpcCallback getCallback()

getChannel

public Channel getChannel()

getRpcId

public byte[] getRpcId()

messageReceived

public void messageReceived(Serializable msg, Member sender)

send

public Response[] send(Member[] destination, Serializable message, int rpcOptions, int channelOptions, long timeout)
Send a message and wait for the response.

Parameters: destination Member[] - the destination for the message, and the members you request a reply from message Serializable - the message you are sending out options int - FIRST_REPLY, MAJORITY_REPLY or ALL_REPLY timeout long - timeout in milliseconds, if no reply is received within this time null is returned

Returns: Response[] - an array of response objects.

Throws: ChannelException

setCallback

public void setCallback(RpcCallback callback)

setChannel

public void setChannel(Channel channel)

setRpcId

public void setRpcId(byte[] rpcId)
Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.