## org.apache.catalina.cluster.tcp
Class AsyncSocketSender

    java.lang.Object
      org.apache.catalina.cluster.tcp.DataSender
          org.apache.catalina.cluster.tcp.AsyncSocketSender

All Implemented Interfaces:
  IDataSender

public class AsyncSocketSender
extends DataSender

Send cluster messages from a Message queue with only one socket. Ack and keep Alive Handling is supported.

- With autoConnect=false at ReplicationTransmitter, you can disconnect the sender and all messages are queued. Only use this for small maintaince isuses!
- waitForAck=true, means that receiver ack the transfer
- after one minute idle time, or number of request (100) the connection is reconnected with next request. Change this for production use!
- default ackTimeout is 15 sec: this is very low for big all session replication messages after restart a node
- disable keepAlive: keepAliveTimeout="-1" and keepAliveMaxRequestCount="-1"

Version:
  $Id: AsyncSocketSender.java 939539 2010-04-30 01:31:33Z kkolinko $
Author:
  Filip Hanik, Peter Rossbach

Field Summary

Fields inherited from class org.apache.catalina.cluster.tcp.DataSender
`connectCounter, createTime, dataFailureCounter, dataResendCounter, disconnectCounter, doProcessingStats, doWaitAckStats, keepAliveConnectTime, keepAliveCount, maxProcessingTime, maxWaitAckTime, minProcessingTime, minWaitAckTime, missingAckCounter, nrOfRequests, processingTime, sm, totalBytes, waitAckTime`

Constructor Summary
`AsyncSocketSender(java.lang.String domain, java.net.InetAddress host, int port)` start background thread to push incomming cluster messages to replication node

Method Summary
`protected void` `checkThread()` Start Queue thread as daemon
`void` `connect()` Connect other cluster member receiver
`void` `disconnect()` Disconnect socket ad stop queue thread
`java.lang.String` `getInfo()` Return descriptive information about this implementation and the corresponding version number, in the format `<description>/<version>`.
`long` `getInQueueCounter()`
`long` `getOutQueueCounter()`
`long` `getQueuedNrOfBytes()`
`int` `getQueueSize()`
`void` `resetStatistics()` Reset sender statistics
`void` `sendMessage(ClusterData data)` Send message to queue for later sending
`protected void` `stopThread()` stop queue worker thread
`java.lang.String` `toString()` Name of this SockerSender

Methods inherited from class org.apache.catalina.cluster.tcp.DataSender

`addProcessingStats, addStats, addWaitAckStats, checkKeepAlive, closeSocket, createSocket, getAckTimeout, getAddress, getAvgMessageSize, getAvgProcessingTime, getAvgWaitAckTime, getConnectCounter, getCreateTime, getDataFailureCounter, getDataResendCounter, getDisconnectCounter, getDomain, getKeepAliveConnectTime, getKeepAliveCount, getKeepAliveMaxRequestCount, getKeepAliveTimeout, getMaxProcessingTime, getMaxWaitAckTime, getMinProcessingTime, getMinWaitAckTime, getMissingAckCounter, getNrOfRequests, getPort, getProcessingTime, getRxBufSize, getSenderState, getSocket, getSocketCloseCounter, getSocketOpenCounter, getSocketOpenFailureCounter, getSoLingerTime, getSoTrafficClass, getSuspect, getTimeout, getTotalBytes, getTxBufSize, getWaitAckTime, isConnected, isDoProcessingStats, isDoWaitAckStats, isMessageTransferStarted, isOoBInline, isResend, isSoKeepAlive, isSoLingerOn, isSoReuseAddress, isSuspect, isTcpNoDelay, isWaitForAck, openSocket, pushMessage, setAckTimeout, setAddress, setDomain, setDoProcessingStats, setDoWaitAckStats, setKeepAliveMaxRequestCount, setKeepAliveTimeout, setOoBInline, setPort, setResend, setRxBufSize, setSocket, setSocketConnected, setSoKeepAlive, setSoLingerOn, setSoLingerTime, setSoReuseAddress, setSoTrafficClass, setSuspect, setTcpNoDelay, setTimeout, setTxBufSize, setWaitForAck, waitForAck, writeData`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### AsyncSocketSender

    public AsyncSocketSender(java.lang.String domain,
                             java.net.InetAddress host,
                             int port)

  start background thread to push incomming cluster messages to replication node

Parameters:
  `domain` - replication cluster domain (session domain)
  `host` - replication node tcp address
  `port` - replication node tcp port

Method Detail

### getInfo

    public java.lang.String getInfo()

  Return descriptive information about this implementation and the corresponding version number, in the format `<description>/<version>`.

  Overrides:
    `getInfo` in class `DataSender`

### getInQueueCounter

    public long getInQueueCounter()

  Returns:
    Returns the inQueueCounter.

### getOutQueueCounter

    public long getOutQueueCounter()

  Returns:
    Returns the outQueueCounter.

### getQueueSize

    public int getQueueSize()

  Returns:
    Returns the queueSize.

### getQueuedNrOfBytes

    public long getQueuedNrOfBytes()

  Returns:
    Returns the queuedNrOfBytes.

### connect

    public void connect()
                 throws java.io.IOException

  Description copied from class: `DataSender`
  Connect other cluster member receiver

  Specified by:
    `connect` in interface `IDataSender`
  Overrides:
    `connect` in class `DataSender`
  Throws:
    `java.io.IOException`
  See Also:
    `IDataSender.connect()`

### disconnect

    public void disconnect()

  Disconnect socket ad stop queue thread

  Specified by:
    `disconnect` in interface `IDataSender`
  Overrides:
    `disconnect` in class `DataSender`
  See Also:
    `IDataSender.disconnect()`

### sendMessage

    public void sendMessage(ClusterData data)
                     throws java.io.IOException

  Send message to queue for later sending

  Specified by:
    `sendMessage` in interface `IDataSender`
  Overrides:
    `sendMessage` in class `DataSender`
  Throws:
    `java.io.IOException`
  See Also:
    `DataSender.pushMessage(ClusterData)`

### resetStatistics

    public void resetStatistics()

  Description copied from class: `DataSender`
  Reset sender statistics

  Overrides:
    `resetStatistics` in class `DataSender`

### toString

    public java.lang.String toString()

  Name of this SockerSender

  Overrides:
    `toString` in class `DataSender`

### checkThread

    protected void checkThread()

  Start Queue thread as daemon

### stopThread

    protected void stopThread()

  stop queue worker thread

Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.