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