Apache Tomcat 6.0.53

org.apache.catalina.tribes.group
Class RpcChannel

java.lang.Object
  extended by org.apache.catalina.tribes.group.RpcChannel
All Implemented Interfaces:
ChannelListener

public class RpcChannel
extends java.lang.Object
implements ChannelListener

A channel to handle RPC messaging

Author:
Filip Hanik

Nested Class Summary
static class RpcChannel.RpcCollector
          Class that holds all response.
static class RpcChannel.RpcCollectorKey
           
 
Field Summary
static int ALL_REPLY
           
static int FIRST_REPLY
           
protected static Log log
           
static int MAJORITY_REPLY
           
static int NO_REPLY
           
 
Constructor Summary
RpcChannel(byte[] rpcId, Channel channel, RpcCallback callback)
          Create an RPC channel.
 
Method Summary
 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 static java.lang.String bToS(byte[] data)
           
 void finalize()
           
 RpcCallback getCallback()
           
 Channel getChannel()
           
 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 setRpcId(byte[] rpcId)
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.catalina.tribes.ChannelListener
equals, hashCode
 

Field Detail

log

protected static Log log

FIRST_REPLY

public static final int FIRST_REPLY
See Also:
Constant Field Values

MAJORITY_REPLY

public static final int MAJORITY_REPLY
See Also:
Constant Field Values

ALL_REPLY

public static final int ALL_REPLY
See Also:
Constant Field Values

NO_REPLY

public static final int NO_REPLY
See Also:
Constant Field Values
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

send

public Response[] send(Member[] destination,
                       java.io.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 from
message - Serializable - the message you are sending out
rpcOptions - int - FIRST_REPLY, MAJORITY_REPLY, ALL_REPLY or NO_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

messageReceived

public void messageReceived(java.io.Serializable msg,
                            Member sender)
Description copied from interface: ChannelListener
Receive a message from the channel

Specified by:
messageReceived in interface ChannelListener
Parameters:
msg - Serializable
sender - - the source of the message

breakdown

public void breakdown()

finalize

public void finalize()
Overrides:
finalize in class java.lang.Object

accept

public boolean accept(java.io.Serializable msg,
                      Member sender)
Description copied from interface: ChannelListener
Invoked by the channel to determine if the listener will process this message or not.

Specified by:
accept in interface ChannelListener
Parameters:
msg - Serializable
sender - Member
Returns:
boolean

getChannel

public Channel getChannel()

getCallback

public RpcCallback getCallback()

getRpcId

public byte[] getRpcId()

setChannel

public void setChannel(Channel channel)

setCallback

public void setCallback(RpcCallback callback)

setRpcId

public void setRpcId(byte[] rpcId)

bToS

protected static java.lang.String bToS(byte[] data)

Apache Tomcat 6.0.53

Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.