RpcChannel (Apache Tomcat 11.0.24 API Documentation)
Description: declaration: package: org.apache.catalina.tribes.group, class: RpcChannel

# Class RpcChannel

java.lang.Object
org.apache.catalina.tribes.group.RpcChannel

All Implemented Interfaces:
  `ChannelListener`

public class RpcChannel extends Object implements ChannelListener
A channel to handle RPC messaging

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `RpcChannel.RpcCollector`
  Class that holds all response.
  `static class`
  `RpcChannel.RpcCollectorKey`
  Key used to identify an RPC collector.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `ALL_REPLY`
  Return replies from all members.
  `static final int`
  `FIRST_REPLY`
  Return the first reply received.
  `static final int`
  `MAJORITY_REPLY`
  Return replies from a majority of members.
  `static final int`
  `NO_REPLY`
  Do not wait for any reply.
  `protected static final StringManager`
  `sm`
  String manager for this class.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `RpcChannel(byte[] rpcId, Channel channel, RpcCallback callback)`
  Create an RPC channel.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `accept(Serializable msg, Member sender)`
  Invoked by the channel to determine if the listener will process this message or not.
  `void`
  `breakdown()`
  Remove this channel listener from the channel.
  `RpcCallback`
  `getCallback()`
  Get the RPC callback handler.
  `Channel`
  `getChannel()`
  Get the underlying channel.
  `int`
  `getReplyMessageOptions()`
  Get the reply message options.
  `byte[]`
  `getRpcId()`
  Get the RPC identifier.
  `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)`
  Set the RPC callback handler.
  `void`
  `setChannel(Channel channel)`
  Set the underlying channel.
  `void`
  `setReplyMessageOptions(int replyMessageOptions)`
  Set the reply message options.
  `void`
  `setRpcId(byte[] rpcId)`
  Set the RPC identifier.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### sm

    protected static final StringManager sm
    String manager for this class.

  - ### FIRST_REPLY

    public static final int FIRST_REPLY
    Return the first reply received.
    See Also:
      - Constant Field Values

  - ### MAJORITY_REPLY

    public static final int MAJORITY_REPLY
    Return replies from a majority of members.
    See Also:
      - Constant Field Values

  - ### ALL_REPLY

    public static final int ALL_REPLY
    Return replies from all members.
    See Also:
      - Constant Field Values

  - ### NO_REPLY

    public static final int NO_REPLY
    Do not wait for any reply.
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### 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 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 from
      `message` - Serializable - the message you are sending out
      `rpcOptions` - int - FIRST_REPLY, MAJORITY_REPLY or ALL_REPLY
      `channelOptions` - channel sender options
      `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` - Error sending message

  - ### messageReceived

    public void messageReceived(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()
    Remove this channel listener from the channel.

  - ### accept

    public boolean accept(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()
    Get the underlying channel.
    Returns:
      the channel

  - ### getCallback

    public RpcCallback getCallback()
    Get the RPC callback handler.
    Returns:
      the callback

  - ### getRpcId

    public byte[] getRpcId()
    Get the RPC identifier.
    Returns:
      the RPC ID

  - ### setChannel

    public void setChannel(Channel channel)
    Set the underlying channel.
    Parameters:
      `channel` - the channel

  - ### setCallback

    public void setCallback(RpcCallback callback)
    Set the RPC callback handler.
    Parameters:
      `callback` - the callback

  - ### setRpcId

    public void setRpcId(byte[] rpcId)
    Set the RPC identifier.
    Parameters:
      `rpcId` - the RPC ID

  - ### getReplyMessageOptions

    public int getReplyMessageOptions()
    Get the reply message options.
    Returns:
      the reply message options

  - ### setReplyMessageOptions

    public void setReplyMessageOptions(int replyMessageOptions)
    Set the reply message options.
    Parameters:
      `replyMessageOptions` - the reply message options