TcpSender (Apache Tomcat 9.0.104 API Documentation)
Description: declaration: package: org.apache.catalina.ha.backend, class: TcpSender

# Class TcpSender

java.lang.Object
org.apache.catalina.ha.backend.TcpSender

All Implemented Interfaces:
  `Sender`

public class TcpSender extends Object implements Sender

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected BufferedReader[]`
  `connectionReaders`
  `protected Socket[]`
  `connections`
  Active connections.
  `protected BufferedWriter[]`
  `connectionWriters`
  `protected Proxy[]`
  `proxies`
  Proxies.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TcpSender()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected void`
  `close(int i)`
  Close connection.
  `void`
  `init(HeartbeatListener config)`
  Set the configuration parameters
  `int`
  `send(String mess)`
  Send the message to the proxies

  ### Methods inherited from class java.lang.Object

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

- ## Field Details

  - ### proxies

    protected Proxy[] proxies
    Proxies.

  - ### connections

    protected Socket[] connections
    Active connections.

  - ### connectionReaders

    protected BufferedReader[] connectionReaders

  - ### connectionWriters

    protected BufferedWriter[] connectionWriters

- ## Constructor Details

  - ### TcpSender

    public TcpSender()

- ## Method Details

  - ### init

    public void init(HeartbeatListener config) throws Exception
    Description copied from interface: `Sender`
    Set the configuration parameters
    Specified by:
      `init` in interface `Sender`
    Parameters:
      `config` - The heartbeat listener configuration
    Throws:
      `Exception` - An error occurred

  - ### send

    public int send(String mess) throws Exception
    Description copied from interface: `Sender`
    Send the message to the proxies
    Specified by:
      `send` in interface `Sender`
    Parameters:
      `mess` - The message that will be sent
    Returns:
      `0` if no error occurred, `-1` otherwise
    Throws:
      `Exception` - An error occurred

  - ### close

    protected void close(int i)
    Close connection.
    Parameters:
      `i` - The index of the connection that will be closed