# Class AbstractSender

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

All Implemented Interfaces:
  `DataSender`

Direct Known Subclasses:
  `NioSender, ParallelNioSender, PooledSender`

public abstract class AbstractSender extends Object implements DataSender
Abstract base implementation of a data sender.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AbstractSender()`
  Constructs a new AbstractSender with default property values.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `InetAddress`
  `getAddress()`
  Returns the InetAddress of the destination.
  `int`
  `getAttempt()`
  Returns the current retry attempt count.
  `long`
  `getConnectTime()`
  Returns the connection time.
  `Member`
  `getDestination()`
  Returns the destination member for this sender.
  `boolean`
  `getDirectBuffer()`
  Returns whether direct (ByteBuffer) buffers are used.
  `int`
  `getKeepAliveCount()`
  Returns the maximum number of requests before disconnecting for keepalive.
  `long`
  `getKeepAliveTime()`
  Returns the maximum time in milliseconds before disconnecting for keepalive.
  `int`
  `getMaxRetryAttempts()`
  Returns the maximum number of retry attempts.
  `boolean`
  `getOoBInline()`
  Returns whether out-of-band data is delivered inline.
  `int`
  `getPort()`
  Returns the port of the destination.
  `int`
  `getRequestCount()`
  Returns the current request count.
  `int`
  `getRxBufSize()`
  Returns the receive buffer size for TCP connections.
  `boolean`
  `getSoKeepAlive()`
  Returns whether SO_KEEPALIVE is enabled.
  `boolean`
  `getSoLingerOn()`
  Returns whether SO_LINGER is enabled.
  `int`
  `getSoLingerTime()`
  Returns the SO_LINGER timeout value in seconds.
  `boolean`
  `getSoReuseAddress()`
  Returns whether SO_REUSEADDR is enabled.
  `int`
  `getSoTrafficClass()`
  Returns the TCP traffic class value.
  `boolean`
  `getTcpNoDelay()`
  Returns whether TCP_NODELAY is enabled.
  `boolean`
  `getThrowOnFailedAck()`
  Returns whether an exception is thrown on ACK failure.
  `long`
  `getTimeout()`
  Returns the connection timeout in milliseconds.
  `int`
  `getTxBufSize()`
  Returns the transmit buffer size for TCP connections.
  `int`
  `getUdpPort()`
  Returns the UDP port of the destination.
  `int`
  `getUdpRxBufSize()`
  Returns the receive buffer size for UDP connections.
  `int`
  `getUdpTxBufSize()`
  Returns the transmit buffer size for UDP connections.
  `boolean`
  `isConnected()`
  Returns whether the sender is connected.
  `boolean`
  `isUdpBased()`
  Returns whether this sender uses UDP-based communication.
  `boolean`
  `keepalive()`
  Keepalive.
  `void`
  `setAddress(InetAddress address)`
  Sets the InetAddress of the destination.
  `void`
  `setAttempt(int attempt)`
  Sets the current retry attempt count.
  `protected void`
  `setConnected(boolean connected)`
  Sets the connected state of this sender.
  `void`
  `setConnectTime(long connectTime)`
  Sets the connection timestamp.
  `void`
  `setDestination(Member destination)`
  Sets the destination member and derives address, port, and UDP port from it.
  `void`
  `setDirectBuffer(boolean directBuffer)`
  Sets whether to use direct (ByteBuffer) buffers.
  `void`
  `setKeepAliveCount(int keepAliveCount)`
  Set the amount of requests during which to keepalive.
  `void`
  `setKeepAliveTime(long keepAliveTime)`
  Set the keepalive time.
  `void`
  `setMaxRetryAttempts(int maxRetryAttempts)`
  Sets the maximum number of retry attempts.
  `void`
  `setOoBInline(boolean ooBInline)`
  Sets whether out-of-band data is delivered inline.
  `void`
  `setPort(int port)`
  Sets the port of the destination.
  `void`
  `setRequestCount(int requestCount)`
  Sets the current request count.
  `void`
  `setRxBufSize(int rxBufSize)`
  Set the receive buffer size.
  `void`
  `setSoKeepAlive(boolean soKeepAlive)`
  Sets whether SO_KEEPALIVE is enabled.
  `void`
  `setSoLingerOn(boolean soLingerOn)`
  Sets whether SO_LINGER is enabled.
  `void`
  `setSoLingerTime(int soLingerTime)`
  Sets the SO_LINGER timeout value in seconds.
  `void`
  `setSoReuseAddress(boolean soReuseAddress)`
  Sets whether SO_REUSEADDR is enabled.
  `void`
  `setSoTrafficClass(int soTrafficClass)`
  Sets the TCP traffic class value.
  `void`
  `setTcpNoDelay(boolean tcpNoDelay)`
  Sets whether TCP_NODELAY is enabled.
  `void`
  `setThrowOnFailedAck(boolean throwOnFailedAck)`
  Sets whether to throw an exception on ACK failure.
  `void`
  `setTimeout(long timeout)`
  Set the socket timeout.
  `void`
  `setTxBufSize(int txBufSize)`
  Set the transmit buffer size.
  `void`
  `setUdpBased(boolean udpBased)`
  Sets whether this sender uses UDP-based communication.
  `void`
  `setUdpPort(int udpPort)`
  Sets the UDP port of the destination.
  `void`
  `setUdpRxBufSize(int udpRxBufSize)`
  Sets the receive buffer size for UDP connections.
  `void`
  `setUdpTxBufSize(int udpTxBufSize)`
  Sets the transmit buffer size for UDP connections.
  `static void`
  `transferProperties(AbstractSender from, AbstractSender to)`
  transfers sender properties from one sender to another

  ### Methods inherited from class Object

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

  ### Methods inherited from interface DataSender

  `connect, disconnect`

- ## Constructor Details

  - ### AbstractSender

    public AbstractSender()
    Constructs a new AbstractSender with default property values.

- ## Method Details

  - ### transferProperties

    public static void transferProperties(AbstractSender from, AbstractSender to)
    transfers sender properties from one sender to another
    Parameters:
      `from` - AbstractSender
      `to` - AbstractSender

  - ### keepalive

    public boolean keepalive()
    Description copied from interface: `DataSender`
    Keepalive.
    Specified by:
      `keepalive` in interface `DataSender`
    Returns:
      `true` if 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: `DataSender`
    Returns whether the sender is connected.
    Specified by:
      `isConnected` in interface `DataSender`
    Returns:
      `true` if connected

  - ### getConnectTime

    public long getConnectTime()
    Description copied from interface: `DataSender`
    Returns the connection time.
    Specified by:
      `getConnectTime` in interface `DataSender`
    Returns:
      the time to connect

  - ### getDestination

    public Member 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: `DataSender`
    Returns the current request count.
    Specified by:
      `getRequestCount` in interface `DataSender`
    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

    public InetAddress 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: `DataSender`
    Set the amount of requests during which to keepalive.
    Specified by:
      `setKeepAliveCount` in interface `DataSender`
    Parameters:
      `keepAliveCount` - the amount of requests

  - ### setKeepAliveTime

    public void setKeepAliveTime(long keepAliveTime)
    Description copied from interface: `DataSender`
    Set the keepalive time.
    Specified by:
      `setKeepAliveTime` in interface `DataSender`
    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: `DataSender`
    Set the receive buffer size.
    Specified by:
      `setRxBufSize` in interface `DataSender`
    Parameters:
      `rxBufSize` - the new size

  - ### setTimeout

    public void setTimeout(long timeout)
    Description copied from interface: `DataSender`
    Set the socket timeout.
    Specified by:
      `setTimeout` in interface `DataSender`
    Parameters:
      `timeout` - in ms

  - ### setTxBufSize

    public void setTxBufSize(int txBufSize)
    Description copied from interface: `DataSender`
    Set the transmit buffer size.
    Specified by:
      `setTxBufSize` in interface `DataSender`
    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

    public void setDestination(Member destination) throws UnknownHostException
    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

    public void setAddress(InetAddress address)
    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