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 ofDataSenderinstances.
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringManagersmStringManager for internationalized log messages.
-
Constructor Summary
Constructors Constructor Description PooledSender()Creates a new PooledSender with the default pool size.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidadd(Member member)Send to the specified member.voidconnect()Connect.voiddisconnect()Disconnect.intgetInPoolSize()Returns the number of senders currently available in the pool.intgetInUsePoolSize()Returns the number of senders currently in use.longgetMaxWait()Returns the maximum time to wait for a sender from the pool, in milliseconds.abstract DataSendergetNewDataSender()Creates and returns a new DataSender instance for the pool.intgetPoolSize()Returns the maximum number of senders in the pool.DataSendergetSender()Retrieves a sender from the pool, waiting up to maxWait milliseconds.booleankeepalive()Keepalive.voidremove(Member member)Stop 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 org.apache.catalina.tribes.transport.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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.catalina.tribes.transport.DataSender
getConnectTime, getRequestCount, isConnected, setKeepAliveCount, setKeepAliveTime, setRxBufSize, setTimeout, setTxBufSize
-
Methods inherited from interface org.apache.catalina.tribes.transport.MultiPointSender
sendMessage, setDirectBuffer, setMaxRetryAttempts
-
-
-
-
Field Detail
-
sm
protected static final StringManager sm
StringManager for internationalized log messages.
-
-
Method Detail
-
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 java.io.IOExceptionDescription copied from interface:DataSenderConnect.- Specified by:
connectin interfaceDataSender- Throws:
java.io.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
public void add(Member member)
Description copied from interface:MultiPointSenderSend to the specified member.- Specified by:
addin interfaceMultiPointSender- Parameters:
member- the member
-
remove
public void remove(Member member)
Description copied from interface:MultiPointSenderStop sending to the specified member.- Specified by:
removein interfaceMultiPointSender- Parameters:
member- the member
-
-