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
An abstract pooled sender that manages a pool of
DataSender instances.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final StringManagerStringManager for internationalized log messages. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidSend to the specified member.voidconnect()Connect.voidDisconnect.intReturns the number of senders currently available in the pool.intReturns the number of senders currently in use.longReturns the maximum time to wait for a sender from the pool, in milliseconds.abstract DataSenderCreates and returns a new DataSender instance for the pool.intReturns the maximum number of senders in the pool.Retrieves a sender from the pool, waiting up to maxWait milliseconds.booleanKeepalive.voidStop sending to the specified member.voidreturnSender(DataSender sender) Returns a sender back to the pool after use.voidsetMaxWait(long maxWait) Sets the maximum time to wait for a sender from the pool, in milliseconds.voidsetPoolSize(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, transferPropertiesMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface DataSender
getConnectTime, getRequestCount, isConnected, setKeepAliveCount, setKeepAliveTime, setRxBufSize, setTimeout, setTxBufSizeMethods inherited from interface MultiPointSender
sendMessage, setDirectBuffer, setMaxRetryAttempts
-
Field Details
-
sm
StringManager for internationalized log messages.
-
-
Constructor Details
-
PooledSender
public PooledSender()Creates a new PooledSender with the default pool size.
-
-
Method Details
-
getNewDataSender
Creates and returns a new DataSender instance for the pool.- Returns:
- a new 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
Returns a sender back to the pool after use.- Parameters:
sender- the sender to return
-
connect
Description copied from interface:DataSenderConnect.- Specified by:
connectin interfaceDataSender- Throws:
IOException- when an error occurs
-
disconnect
public void disconnect()Description copied from interface:DataSenderDisconnect.- Specified by:
disconnectin interfaceDataSender
-
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:DataSenderKeepalive.- Specified by:
keepalivein interfaceDataSender- Overrides:
keepalivein classAbstractSender- Returns:
trueif kept alive
-
add
Description copied from interface:MultiPointSenderSend to the specified member.- Specified by:
addin interfaceMultiPointSender- Parameters:
member- the member
-
remove
Description copied from interface:MultiPointSenderStop sending to the specified member.- Specified by:
removein interfaceMultiPointSender- Parameters:
member- the member
-