ReplicationTransmitter (Tomcat API Documentation)
Keywords: org.apache.catalina.cluster.tcp.ReplicationTransmitter class

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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

    java.lang.Object
      org.apache.catalina.cluster.tcp.ReplicationTransmitter

All Implemented Interfaces:
  ClusterSender, IDynamicProperty

public class ReplicationTransmitter
extends java.lang.Object
implements ClusterSender, IDynamicProperty

Transmit message to ohter cluster members create sender from replicationMode type FIXME i18n log messages FIXME compress data depends on message type and size FIXME send very big messages at some block see FarmWarDeployer! TODO pause and resume senders

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

Field Summary
`protected boolean` | `doTransmitterProcessingStats` doTransmitterProcessingStats
`protected long` | `maxProcessingTime` max proessingTime
`protected long` | `minProcessingTime` min proessingTime
`protected long` | `processingTime` proessingTime
`protected int` | `processSenderFrequency` Frequency of the check sender keepAlive Socket Status.
`protected StringManager` | `sm` The string manager for this package.

Constructor Summary
`ReplicationTransmitter()`

Method Summary
`void` | `add(Member member)` add new cluster member and create sender ( s. replicationMode) transfer current properties to sender
`protected void` | `addProcessingStats(long startTime)` Add processing stats times
`protected void` | `addStats(int length)` calc number of requests and transfered bytes.
`void` | `backgroundProcess()` Call transmitter to check for sender socket status
`void` | `checkKeepAlive()` Check all DataSender Socket to close socket at keepAlive mode
`long` | `getAckTimeout()`
`double` | `getAvgProcessingTime()`
`long` | `getFailureCounter()`
`java.lang.String` | `getInfo()` Return descriptive information about this implementation and the corresponding version number, in the format `<description>/<version>`.
`boolean` | `getIsSenderSynchronized()` Deprecated. since version 5.5.7
`protected java.lang.String` | `getKey(Member member)` set unique key to find sender
`long` | `getMaxProcessingTime()`
`long` | `getMinProcessingTime()`
`long` | `getNrOfRequests()`
`javax.management.ObjectName` | `getObjectName()`
`long` | `getProcessingTime()`
`int` | `getProcessSenderFrequency()`
`java.lang.Object` | `getProperty(java.lang.String key)` get current config
`java.util.Iterator` | `getPropertyNames()` Get all properties keys
`java.lang.String` | `getReplicationMode()` current replication mode
`protected javax.management.ObjectName` | `getSenderObjectName(IDataSender sender)` build sender ObjectName ( engine.domain:type=IDataSender,host="host",senderAddress="receiver.address",senderPort="port" )
`javax.management.ObjectName[]` | `getSenderObjectNames()` get all current senders
`IDataSender[]` | `getSenders()` get all current senders
`long` | `getTotalBytes()`
`boolean` | `isAutoConnect()`
`boolean` | `isCompress()`
`boolean` | `isDoTransmitterProcessingStats()`
`boolean` | `isWaitForAck()`
`protected void` | `registerSenderMBean(Member member, IDataSender sender)` register MBean and check it exist (big problem!)
`void` | `remove(Member member)` remove sender from transmitter. ( deregister mbean and disconnect sender )
`void` | `removeProperty(java.lang.String key)` remove a configured property.
`void` | `resetStatistics()` Reset sender statistics
`void` | `sendMessage(ClusterMessage message)` send message to all senders (broadcast)
`void` | `sendMessage(ClusterMessage message, Member member)` Send data to one member FIXME set filtering messages
`void` | `sendMessageClusterDomain(ClusterMessage message)` Send to all senders at same cluster domain as message from address
`protected boolean` | `sendMessageData(ClusterData data, IDataSender sender)` Send message to concrete sender.
`protected ClusterData` | `serialize(ClusterMessage msg)` serialize message and add timestamp from message handle compression
`void` | `setAckTimeout(long ackTimeout)`
`void` | `setAutoConnect(boolean autoConnect)`
`void` | `setCatalinaCluster(SimpleTcpCluster cluster)`
`void` | `setCompress(boolean compressMessageData)`
`void` | `setDoTransmitterProcessingStats(boolean doProcessingStats)`
`void` | `setObjectName(javax.management.ObjectName name)` Transmitter ObjectName
`void` | `setProcessSenderFrequency(int processSenderFrequency)`
`void` | `setProperty(java.lang.String name, java.lang.Object value)` set config attributes with reflect
`void` | `setReplicationMode(java.lang.String mode)` set replication Mode (pooled, synchonous, asynchonous, fastasyncqueue)
`void` | `setWaitForAck(boolean waitForAck)`
`void` | `start()` start the sender and register transmitter mbean
`void` | `stop()`
`protected void` | `transferSenderProperty(IDataSender sender)` Transfer all properties from transmitter to concrete sender
`protected void` | `unregisterSenderMBean(IDataSender sender)` unregsister sendern Mbean

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

Field Detail

### sm

    protected StringManager sm

  The string manager for this package.

### processSenderFrequency

    protected int processSenderFrequency

  Frequency of the check sender keepAlive Socket Status.

### doTransmitterProcessingStats

    protected boolean doTransmitterProcessingStats

  doTransmitterProcessingStats

### processingTime

    protected long processingTime

  proessingTime

### minProcessingTime

    protected long minProcessingTime

  min proessingTime

### maxProcessingTime

    protected long maxProcessingTime

  max proessingTime

Constructor Detail

### ReplicationTransmitter

    public ReplicationTransmitter()

Method Detail

### getInfo

    public java.lang.String getInfo()

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

### getNrOfRequests

    public long getNrOfRequests()

  Returns:
    Returns the nrOfRequests.

### getTotalBytes

    public long getTotalBytes()

  Returns:
    Returns the totalBytes.

### getFailureCounter

    public long getFailureCounter()

  Returns:
    Returns the failureCounter.

### getReplicationMode

    public java.lang.String getReplicationMode()

  current replication mode

  Returns:
    The mode

### setReplicationMode

    public void setReplicationMode(java.lang.String mode)

  set replication Mode (pooled, synchonous, asynchonous, fastasyncqueue)

  Parameters:
    `mode` -
  See Also:
    `IDataSenderFactory.validateMode(String)`

### getAvgProcessingTime

    public double getAvgProcessingTime()

  Returns:
    Returns the avg processingTime/nrOfRequests.

### getMaxProcessingTime

    public long getMaxProcessingTime()

  Returns:
    Returns the maxProcessingTime.

### getMinProcessingTime

    public long getMinProcessingTime()

  Returns:
    Returns the minProcessingTime.

### getProcessingTime

    public long getProcessingTime()

  Returns:
    Returns the processingTime.

### isDoTransmitterProcessingStats

    public boolean isDoTransmitterProcessingStats()

  Returns:
    Returns the doTransmitterProcessingStats.

### setDoTransmitterProcessingStats

    public void setDoTransmitterProcessingStats(boolean doProcessingStats)

  Parameters:
    `doProcessingStats` - The doTransmitterProcessingStats to set.

### setObjectName

    public void setObjectName(javax.management.ObjectName name)

  Transmitter ObjectName

  Parameters:
    `name` -

### getObjectName

    public javax.management.ObjectName getObjectName()

### isCompress

    public boolean isCompress()

  Specified by:
    `isCompress` in interface `ClusterSender`
  Returns:
    Returns the compress.

### setCompress

    public void setCompress(boolean compressMessageData)

  Specified by:
    `setCompress` in interface `ClusterSender`
  Parameters:
    `compressMessageData` - The compress to set.

### isAutoConnect

    public boolean isAutoConnect()

  Returns:
    Returns the autoConnect.

### setAutoConnect

    public void setAutoConnect(boolean autoConnect)

  Parameters:
    `autoConnect` - The autoConnect to set.

### getAckTimeout

    public long getAckTimeout()

  Returns:
    The ack timeout

### setAckTimeout

    public void setAckTimeout(long ackTimeout)

  Parameters:
    `ackTimeout` -

### isWaitForAck

    public boolean isWaitForAck()

  Specified by:
    `isWaitForAck` in interface `ClusterSender`
  Returns:
    Returns the waitForAck.

### setWaitForAck

    public void setWaitForAck(boolean waitForAck)

  Specified by:
    `setWaitForAck` in interface `ClusterSender`
  Parameters:
    `waitForAck` - The waitForAck to set.

### getProcessSenderFrequency

    public int getProcessSenderFrequency()

  Returns:
    Returns the processSenderFrequency.

### setProcessSenderFrequency

    public void setProcessSenderFrequency(int processSenderFrequency)

  Parameters:
    `processSenderFrequency` - The processSenderFrequency to set.

### setCatalinaCluster

    public void setCatalinaCluster(SimpleTcpCluster cluster)

  Specified by:
    `setCatalinaCluster` in interface `ClusterSender`
  Parameters:
    `cluster` -

### getIsSenderSynchronized

    public boolean getIsSenderSynchronized()

  Deprecated. since version 5.5.7

  Returns:
    True if synchronized sender

### setProperty

    public void setProperty(java.lang.String name,
                            java.lang.Object value)

  set config attributes with reflect

  Specified by:
    `setProperty` in interface `IDynamicProperty`
  Parameters:
    `name` -
    `value` -

### getProperty

    public java.lang.Object getProperty(java.lang.String key)

  get current config

  Specified by:
    `getProperty` in interface `IDynamicProperty`
  Parameters:
    `key` -
  Returns:
    The property

### getPropertyNames

    public java.util.Iterator getPropertyNames()

  Get all properties keys

  Specified by:
    `getPropertyNames` in interface `IDynamicProperty`
  Returns:
    An iterator over the propery name set

### removeProperty

    public void removeProperty(java.lang.String key)

  remove a configured property.

  Specified by:
    `removeProperty` in interface `IDynamicProperty`
  Parameters:
    `key` -

### sendMessage

    public void sendMessage(ClusterMessage message,
                            Member member)
                     throws java.io.IOException

  Send data to one member FIXME set filtering messages

  Specified by:
    `sendMessage` in interface `ClusterSender`
  Throws:
    `java.io.IOException`
  See Also:
    `ClusterSender.sendMessage(org.apache.catalina.cluster.ClusterMessage, org.apache.catalina.cluster.Member)`

### sendMessageClusterDomain

    public void sendMessageClusterDomain(ClusterMessage message)
                                  throws java.io.IOException

  Send to all senders at same cluster domain as message from address

  Specified by:
    `sendMessageClusterDomain` in interface `ClusterSender`
  Parameters:
    `message` - Cluster message to send
  Throws:
    `java.io.IOException`
  Since:
    5.5.10 FIXME Refactor with sendMessage get a sender list from

### sendMessage

    public void sendMessage(ClusterMessage message)
                     throws java.io.IOException

  send message to all senders (broadcast)

  Specified by:
    `sendMessage` in interface `ClusterSender`
  Throws:
    `java.io.IOException`
  See Also:
    `FIXME Refactor with sendMessageClusterDomain!`

### start

    public void start()
               throws java.io.IOException

  start the sender and register transmitter mbean

  Specified by:
    `start` in interface `ClusterSender`
  Throws:
    `java.io.IOException`
  See Also:
    `ClusterSender.start()`

### stop

    public void stop()

  Specified by:
    `stop` in interface `ClusterSender`

### backgroundProcess

    public void backgroundProcess()

  Call transmitter to check for sender socket status

  Specified by:
    `backgroundProcess` in interface `ClusterSender`
  See Also:
    `SimpleTcpCluster.backgroundProcess()`

### checkKeepAlive

    public void checkKeepAlive()

  Check all DataSender Socket to close socket at keepAlive mode

  See Also:
    `DataSender.checkKeepAlive()`

### getSenders

    public IDataSender[] getSenders()

  get all current senders

  Returns:
    The senders

### getSenderObjectNames

    public javax.management.ObjectName[] getSenderObjectNames()

  get all current senders

  Returns:
    The sender object names

### resetStatistics

    public void resetStatistics()

  Reset sender statistics

### add

    public void add(Member member)

  add new cluster member and create sender ( s. replicationMode) transfer current properties to sender

  Specified by:
    `add` in interface `ClusterSender`
  See Also:
    `ClusterSender.add(org.apache.catalina.cluster.Member)`

### remove

    public void remove(Member member)

  remove sender from transmitter. ( deregister mbean and disconnect sender )

  Specified by:
    `remove` in interface `ClusterSender`
  See Also:
    `ClusterSender.remove(org.apache.catalina.cluster.Member)`

### addStats

    protected void addStats(int length)

  calc number of requests and transfered bytes. Log stats all 100 requets

  Parameters:
    `length` -

### transferSenderProperty

    protected void transferSenderProperty(IDataSender sender)

  Transfer all properties from transmitter to concrete sender

  Parameters:
    `sender` -

### getKey

    protected java.lang.String getKey(Member member)

  set unique key to find sender

  Parameters:
    `member` -
  Returns:
    concat member.host:member.port

### unregisterSenderMBean

    protected void unregisterSenderMBean(IDataSender sender)

  unregsister sendern Mbean

  Parameters:
    `sender` -
  See Also:
    `getSenderObjectName(IDataSender)`

### registerSenderMBean

    protected void registerSenderMBean(Member member,
                                       IDataSender sender)

  register MBean and check it exist (big problem!)

  Parameters:
    `member` -
    `sender` -

### getSenderObjectName

    protected javax.management.ObjectName getSenderObjectName(IDataSender sender)

  build sender ObjectName ( engine.domain:type=IDataSender,host="host",senderAddress="receiver.address",senderPort="port" )

  Parameters:
    `sender` -
  Returns:
    The sender object name

### serialize

    protected ClusterData serialize(ClusterMessage msg)
                             throws java.io.IOException

  serialize message and add timestamp from message handle compression

  Parameters:
    `msg` - cluster message
  Returns:
    cluster message as byte array
  Throws:
    `java.io.IOException`
  Since:
    5.5.10
  See Also:
    `GZIPOutputStream`

### sendMessageData

    protected boolean sendMessageData(ClusterData data,
                                      IDataSender sender)
                               throws java.io.IOException

  Send message to concrete sender. If autoConnect is true, check is connection broken and the reconnect the complete sender.
  - failure the suspect flag is set true. After successfully sending the suspect flag is set to false.
  - Stats is only update after sussesfull sending

  Parameters:
    `data` - message Data
    `sender` - concrete message sender
  Returns:
    true if the message got sent, false otherwise
  Throws:
    `java.io.IOException` - If an error occurs

### addProcessingStats

    protected void addProcessingStats(long startTime)

  Add processing stats times

  Parameters:
    `startTime` -

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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