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 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