PooledSender (Apache Tomcat 11.0.23 API Documentation)
Description: declaration: package: org.apache.catalina.tribes.transport, class: PooledSender

# Class PooledSender

java.lang.Object
org.apache.catalina.tribes.transport.AbstractSender
org.apache.catalina.tribes.transport.PooledSender

All Implemented Interfaces:
  `DataSender, MultiPointSender`

Direct Known Subclasses:
  `PooledParallelSender`

public abstract class PooledSender extends AbstractSender implements MultiPointSender
An abstract pooled sender that manages a pool of `DataSender` instances.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected static final StringManager`
  `sm`
  StringManager for internationalized log messages.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `PooledSender()`
  Creates a new PooledSender with the default pool size.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `add(Member member)`
  Send to the specified member.
  `void`
  `connect()`
  Connect.
  `void`
  `disconnect()`
  Disconnect.
  `int`
  `getInPoolSize()`
  Returns the number of senders currently available in the pool.
  `int`
  `getInUsePoolSize()`
  Returns the number of senders currently in use.
  `long`
  `getMaxWait()`
  Returns the maximum time to wait for a sender from the pool, in milliseconds.
  `abstract DataSender`
  `getNewDataSender()`
  Creates and returns a new DataSender instance for the pool.
  `int`
  `getPoolSize()`
  Returns the maximum number of senders in the pool.
  `DataSender`
  `getSender()`
  Retrieves a sender from the pool, waiting up to maxWait milliseconds.
  `boolean`
  `keepalive()`
  Keepalive.
  `void`
  `remove(Member member)`
  Stop sending to the specified member.
  `void`
  `returnSender(DataSender sender)`
  Returns a sender back to the pool after use.
  `void`
  `setMaxWait(long maxWait)`
  Sets the maximum time to wait for a sender from the pool, in milliseconds.
  `void`
  `setPoolSize(int poolSize)`
  Sets the maximum number of senders in the pool.

  ### Methods inherited from class AbstractSender

  `getAddress, getAttempt, getConnectTime, getDestination, getDirectBuffer, getKeepAliveCount, getKeepAliveTime, getMaxRetryAttempts, getOoBInline, getPort, getRequestCount, getRxBufSize, getSoKeepAlive, getSoLingerOn, getSoLingerTime, getSoReuseAddress, getSoTrafficClass, getTcpNoDelay, getThrowOnFailedAck, getTimeout, getTxBufSize, getUdpPort, getUdpRxBufSize, getUdpTxBufSize, isConnected, isUdpBased, setAddress, setAttempt, setConnected, setConnectTime, setDestination, setDirectBuffer, setKeepAliveCount, setKeepAliveTime, setMaxRetryAttempts, setOoBInline, setPort, setRequestCount, setRxBufSize, setSoKeepAlive, setSoLingerOn, setSoLingerTime, setSoReuseAddress, setSoTrafficClass, setTcpNoDelay, setThrowOnFailedAck, setTimeout, setTxBufSize, setUdpBased, setUdpPort, setUdpRxBufSize, setUdpTxBufSize, transferProperties`

  ### Methods inherited from class Object

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

  ### Methods inherited from interface DataSender

  `getConnectTime, getRequestCount, isConnected, setKeepAliveCount, setKeepAliveTime, setRxBufSize, setTimeout, setTxBufSize`

  ### Methods inherited from interface MultiPointSender

  `sendMessage, setDirectBuffer, setMaxRetryAttempts`

- ## Field Details

  - ### sm

    protected static final StringManager sm
    StringManager for internationalized log messages.

- ## Constructor Details

  - ### PooledSender

    public PooledSender()
    Creates a new PooledSender with the default pool size.

- ## Method Details

  - ### getNewDataSender

    public abstract DataSender getNewDataSender()
    Creates and returns a new DataSender instance for the pool.
    Returns:
      a new DataSender

  - ### getSender

    public DataSender getSender()
    Retrieves a sender from the pool, waiting up to maxWait milliseconds.
    Returns:
      a DataSender from the pool, or null if timeout expires

  - ### returnSender

    public void returnSender(DataSender sender)
    Returns a sender back to the pool after use.
    Parameters:
      `sender` - the sender to return

  - ### connect

    public void connect() throws IOException
    Description copied from interface: `DataSender`
    Connect.
    Specified by:
      `connect` in interface `DataSender`
    Throws:
      `IOException` - when an error occurs

  - ### disconnect

    public void disconnect()
    Description copied from interface: `DataSender`
    Disconnect.
    Specified by:
      `disconnect` in interface `DataSender`

  - ### getInPoolSize

    public int getInPoolSize()
    Returns the number of senders currently available in the pool.
    Returns:
      the number of senders in the pool

  - ### getInUsePoolSize

    public int getInUsePoolSize()
    Returns the number of senders currently in use.
    Returns:
      the number of senders in use

  - ### setPoolSize

    public void setPoolSize(int poolSize)
    Sets the maximum number of senders in the pool.
    Parameters:
      `poolSize` - the pool size

  - ### getPoolSize

    public int getPoolSize()
    Returns the maximum number of senders in the pool.
    Returns:
      the pool size

  - ### getMaxWait

    public long getMaxWait()
    Returns the maximum time to wait for a sender from the pool, in milliseconds.
    Returns:
      the maximum wait time

  - ### setMaxWait

    public void setMaxWait(long maxWait)
    Sets the maximum time to wait for a sender from the pool, in milliseconds.
    Parameters:
      `maxWait` - the maximum wait time

  - ### keepalive

    public boolean keepalive()
    Description copied from interface: `DataSender`
    Keepalive.
    Specified by:
      `keepalive` in interface `DataSender`
    Overrides:
      `keepalive` in class `AbstractSender`
    Returns:
      `true` if kept alive

  - ### add

    public void add(Member member)
    Description copied from interface: `MultiPointSender`
    Send to the specified member.
    Specified by:
      `add` in interface `MultiPointSender`
    Parameters:
      `member` - the member

  - ### remove

    public void remove(Member member)
    Description copied from interface: `MultiPointSender`
    Stop sending to the specified member.
    Specified by:
      `remove` in interface `MultiPointSender`
    Parameters:
      `member` - the member