Class AbstractSender
java.lang.Object
org.apache.catalina.tribes.transport.AbstractSender
- All Implemented Interfaces:
DataSender
- Direct Known Subclasses:
NioSender, ParallelNioSender, PooledSender
Abstract base implementation of a data sender.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new AbstractSender with default property values. -
Method Summary
Modifier and TypeMethodDescriptionReturns the InetAddress of the destination.intReturns the current retry attempt count.longReturns the connection time.Returns the destination member for this sender.booleanReturns whether direct (ByteBuffer) buffers are used.intReturns the maximum number of requests before disconnecting for keepalive.longReturns the maximum time in milliseconds before disconnecting for keepalive.intReturns the maximum number of retry attempts.booleanReturns whether out-of-band data is delivered inline.intgetPort()Returns the port of the destination.intReturns the current request count.intReturns the receive buffer size for TCP connections.booleanReturns whether SO_KEEPALIVE is enabled.booleanReturns whether SO_LINGER is enabled.intReturns the SO_LINGER timeout value in seconds.booleanReturns whether SO_REUSEADDR is enabled.intReturns the TCP traffic class value.booleanReturns whether TCP_NODELAY is enabled.booleanReturns whether an exception is thrown on ACK failure.longReturns the connection timeout in milliseconds.intReturns the transmit buffer size for TCP connections.intReturns the UDP port of the destination.intReturns the receive buffer size for UDP connections.intReturns the transmit buffer size for UDP connections.booleanReturns whether the sender is connected.booleanReturns whether this sender uses UDP-based communication.booleanKeepalive.voidsetAddress(InetAddress address) Sets the InetAddress of the destination.voidsetAttempt(int attempt) Sets the current retry attempt count.protected voidsetConnected(boolean connected) Sets the connected state of this sender.voidsetConnectTime(long connectTime) Sets the connection timestamp.voidsetDestination(Member destination) Sets the destination member and derives address, port, and UDP port from it.voidsetDirectBuffer(boolean directBuffer) Sets whether to use direct (ByteBuffer) buffers.voidsetKeepAliveCount(int keepAliveCount) Set the amount of requests during which to keepalive.voidsetKeepAliveTime(long keepAliveTime) Set the keepalive time.voidsetMaxRetryAttempts(int maxRetryAttempts) Sets the maximum number of retry attempts.voidsetOoBInline(boolean ooBInline) Sets whether out-of-band data is delivered inline.voidsetPort(int port) Sets the port of the destination.voidsetRequestCount(int requestCount) Sets the current request count.voidsetRxBufSize(int rxBufSize) Set the receive buffer size.voidsetSoKeepAlive(boolean soKeepAlive) Sets whether SO_KEEPALIVE is enabled.voidsetSoLingerOn(boolean soLingerOn) Sets whether SO_LINGER is enabled.voidsetSoLingerTime(int soLingerTime) Sets the SO_LINGER timeout value in seconds.voidsetSoReuseAddress(boolean soReuseAddress) Sets whether SO_REUSEADDR is enabled.voidsetSoTrafficClass(int soTrafficClass) Sets the TCP traffic class value.voidsetTcpNoDelay(boolean tcpNoDelay) Sets whether TCP_NODELAY is enabled.voidsetThrowOnFailedAck(boolean throwOnFailedAck) Sets whether to throw an exception on ACK failure.voidsetTimeout(long timeout) Set the socket timeout.voidsetTxBufSize(int txBufSize) Set the transmit buffer size.voidsetUdpBased(boolean udpBased) Sets whether this sender uses UDP-based communication.voidsetUdpPort(int udpPort) Sets the UDP port of the destination.voidsetUdpRxBufSize(int udpRxBufSize) Sets the receive buffer size for UDP connections.voidsetUdpTxBufSize(int udpTxBufSize) Sets the transmit buffer size for UDP connections.static voidtransferProperties(AbstractSender from, AbstractSender to) transfers sender properties from one sender to anotherMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface DataSender
connect, disconnect
-
Constructor Details
-
AbstractSender
public AbstractSender()Constructs a new AbstractSender with default property values.
-
-
Method Details
-
transferProperties
transfers sender properties from one sender to another- Parameters:
from- AbstractSenderto- AbstractSender
-
keepalive
public boolean keepalive()Description copied from interface:DataSenderKeepalive.- Specified by:
keepalivein interfaceDataSender- Returns:
trueif kept alive
-
setConnected
protected void setConnected(boolean connected) Sets the connected state of this sender.- Parameters:
connected- the new connected state
-
isConnected
public boolean isConnected()Description copied from interface:DataSenderReturns whether the sender is connected.- Specified by:
isConnectedin interfaceDataSender- Returns:
trueif connected
-
getConnectTime
public long getConnectTime()Description copied from interface:DataSenderReturns the connection time.- Specified by:
getConnectTimein interfaceDataSender- Returns:
- the time to connect
-
getDestination
Returns the destination member for this sender.- Returns:
- the destination member
-
getKeepAliveCount
public int getKeepAliveCount()Returns the maximum number of requests before disconnecting for keepalive.- Returns:
- the keep alive count, -1 means disabled
-
getKeepAliveTime
public long getKeepAliveTime()Returns the maximum time in milliseconds before disconnecting for keepalive.- Returns:
- the keep alive time in milliseconds, -1 means disabled
-
getRequestCount
public int getRequestCount()Description copied from interface:DataSenderReturns the current request count.- Specified by:
getRequestCountin interfaceDataSender- Returns:
- the request count
-
getRxBufSize
public int getRxBufSize()Returns the receive buffer size for TCP connections.- Returns:
- the receive buffer size
-
getTimeout
public long getTimeout()Returns the connection timeout in milliseconds.- Returns:
- the timeout value
-
getTxBufSize
public int getTxBufSize()Returns the transmit buffer size for TCP connections.- Returns:
- the transmit buffer size
-
getAddress
Returns the InetAddress of the destination.- Returns:
- the destination address
-
getPort
public int getPort()Returns the port of the destination.- Returns:
- the destination port
-
getMaxRetryAttempts
public int getMaxRetryAttempts()Returns the maximum number of retry attempts.- Returns:
- the maximum retry attempts
-
setDirectBuffer
public void setDirectBuffer(boolean directBuffer) Sets whether to use direct (ByteBuffer) buffers.- Parameters:
directBuffer- true to use direct buffers
-
getDirectBuffer
public boolean getDirectBuffer()Returns whether direct (ByteBuffer) buffers are used.- Returns:
- true if direct buffers are used
-
getAttempt
public int getAttempt()Returns the current retry attempt count.- Returns:
- the attempt count
-
getTcpNoDelay
public boolean getTcpNoDelay()Returns whether TCP_NODELAY is enabled.- Returns:
- true if TCP_NODELAY is enabled
-
getSoKeepAlive
public boolean getSoKeepAlive()Returns whether SO_KEEPALIVE is enabled.- Returns:
- true if SO_KEEPALIVE is enabled
-
getOoBInline
public boolean getOoBInline()Returns whether out-of-band data is delivered inline.- Returns:
- true if OO_BINLINE is enabled
-
getSoReuseAddress
public boolean getSoReuseAddress()Returns whether SO_REUSEADDR is enabled.- Returns:
- true if SO_REUSEADDR is enabled
-
getSoLingerOn
public boolean getSoLingerOn()Returns whether SO_LINGER is enabled.- Returns:
- true if SO_LINGER is enabled
-
getSoLingerTime
public int getSoLingerTime()Returns the SO_LINGER timeout value in seconds.- Returns:
- the linger time
-
getSoTrafficClass
public int getSoTrafficClass()Returns the TCP traffic class value.- Returns:
- the traffic class value
-
getThrowOnFailedAck
public boolean getThrowOnFailedAck()Returns whether an exception is thrown on ACK failure.- Returns:
- true if exceptions are thrown on failed ACKs
-
setKeepAliveCount
public void setKeepAliveCount(int keepAliveCount) Description copied from interface:DataSenderSet the amount of requests during which to keepalive.- Specified by:
setKeepAliveCountin interfaceDataSender- Parameters:
keepAliveCount- the amount of requests
-
setKeepAliveTime
public void setKeepAliveTime(long keepAliveTime) Description copied from interface:DataSenderSet the keepalive time.- Specified by:
setKeepAliveTimein interfaceDataSender- Parameters:
keepAliveTime- the time in ms
-
setRequestCount
public void setRequestCount(int requestCount) Sets the current request count.- Parameters:
requestCount- the new request count
-
setRxBufSize
public void setRxBufSize(int rxBufSize) Description copied from interface:DataSenderSet the receive buffer size.- Specified by:
setRxBufSizein interfaceDataSender- Parameters:
rxBufSize- the new size
-
setTimeout
public void setTimeout(long timeout) Description copied from interface:DataSenderSet the socket timeout.- Specified by:
setTimeoutin interfaceDataSender- Parameters:
timeout- in ms
-
setTxBufSize
public void setTxBufSize(int txBufSize) Description copied from interface:DataSenderSet the transmit buffer size.- Specified by:
setTxBufSizein interfaceDataSender- Parameters:
txBufSize- the new size
-
setConnectTime
public void setConnectTime(long connectTime) Sets the connection timestamp.- Parameters:
connectTime- the connect time timestamp
-
setMaxRetryAttempts
public void setMaxRetryAttempts(int maxRetryAttempts) Sets the maximum number of retry attempts.- Parameters:
maxRetryAttempts- the maximum retry attempts
-
setAttempt
public void setAttempt(int attempt) Sets the current retry attempt count.- Parameters:
attempt- the attempt count
-
setTcpNoDelay
public void setTcpNoDelay(boolean tcpNoDelay) Sets whether TCP_NODELAY is enabled.- Parameters:
tcpNoDelay- true to enable TCP_NODELAY
-
setSoKeepAlive
public void setSoKeepAlive(boolean soKeepAlive) Sets whether SO_KEEPALIVE is enabled.- Parameters:
soKeepAlive- true to enable SO_KEEPALIVE
-
setOoBInline
public void setOoBInline(boolean ooBInline) Sets whether out-of-band data is delivered inline.- Parameters:
ooBInline- true to enable OO_BINLINE
-
setSoReuseAddress
public void setSoReuseAddress(boolean soReuseAddress) Sets whether SO_REUSEADDR is enabled.- Parameters:
soReuseAddress- true to enable SO_REUSEADDR
-
setSoLingerOn
public void setSoLingerOn(boolean soLingerOn) Sets whether SO_LINGER is enabled.- Parameters:
soLingerOn- true to enable SO_LINGER
-
setSoLingerTime
public void setSoLingerTime(int soLingerTime) Sets the SO_LINGER timeout value in seconds.- Parameters:
soLingerTime- the linger time in seconds
-
setSoTrafficClass
public void setSoTrafficClass(int soTrafficClass) Sets the TCP traffic class value.- Parameters:
soTrafficClass- the traffic class value
-
setThrowOnFailedAck
public void setThrowOnFailedAck(boolean throwOnFailedAck) Sets whether to throw an exception on ACK failure.- Parameters:
throwOnFailedAck- true to throw on failed ACKs
-
setDestination
Sets the destination member and derives address, port, and UDP port from it.- Parameters:
destination- the destination member- Throws:
UnknownHostException- if the address cannot be determined
-
setPort
public void setPort(int port) Sets the port of the destination.- Parameters:
port- the destination port
-
setAddress
Sets the InetAddress of the destination.- Parameters:
address- the destination address
-
isUdpBased
public boolean isUdpBased()Returns whether this sender uses UDP-based communication.- Returns:
- true if UDP-based
-
setUdpBased
public void setUdpBased(boolean udpBased) Sets whether this sender uses UDP-based communication.- Parameters:
udpBased- true if UDP-based
-
getUdpPort
public int getUdpPort()Returns the UDP port of the destination.- Returns:
- the UDP port
-
setUdpPort
public void setUdpPort(int udpPort) Sets the UDP port of the destination.- Parameters:
udpPort- the UDP port
-
getUdpRxBufSize
public int getUdpRxBufSize()Returns the receive buffer size for UDP connections.- Returns:
- the UDP receive buffer size
-
setUdpRxBufSize
public void setUdpRxBufSize(int udpRxBufSize) Sets the receive buffer size for UDP connections.- Parameters:
udpRxBufSize- the UDP receive buffer size
-
getUdpTxBufSize
public int getUdpTxBufSize()Returns the transmit buffer size for UDP connections.- Returns:
- the UDP transmit buffer size
-
setUdpTxBufSize
public void setUdpTxBufSize(int udpTxBufSize) Sets the transmit buffer size for UDP connections.- Parameters:
udpTxBufSize- the UDP transmit buffer size
-