fulmine.distribution.connection.tcp
Class TcpConnectionDiscoverer

java.lang.Object
  extended by fulmine.AbstractLifeCycle
      extended by fulmine.distribution.connection.AbstractConnectionDiscoverer
          extended by fulmine.distribution.connection.tcp.TcpConnectionDiscoverer
All Implemented Interfaces:
IConnectionDiscoverer, IHeartbeatMonitor, IDestroyable, ILifeCycle

public final class TcpConnectionDiscoverer
extends AbstractConnectionDiscoverer
implements IConnectionDiscoverer

A discoverer for remote contexts that use TCP/IP.

Author:
Ramon Servadei

Field Summary
 
Fields inherited from class fulmine.distribution.connection.AbstractConnectionDiscoverer
DEFAULT_DUPLICATE_PING_WINDOW, DEFAULT_UDP_DISCOVERY_NETWORK, DEFAULT_UDP_DISCOVERY_PORT, description, heartbeatGenerator, heartbeatGeneratorThread, heartbeatListener, heartbeatListenerThread, heartbeatProcessor, heartbeatProcessorThread, network, NETWORK_INTERFACE_NAME, pulse, socket, UDP_DISCOVERY_NETWORK, UDP_DISCOVERY_PORT
 
Fields inherited from interface fulmine.distribution.IHeartbeatMonitor
DEFAULT_ALLOWED_MISSED_COUNT, DEFAULT_HEARTBEAT_PERIOD
 
Constructor Summary
TcpConnectionDiscoverer(IFrameworkContext context, String hostAddress, int tcpPort, String udpNetwork, int udpPort, String udpNic)
          Constructs the discoverer with specific UDP binding parameters and extracts the TCP connection details from the broker
 
Method Summary
protected  void doStart()
          Overridden in subclasses to perform custom logic on activation.
protected  IConnectionParameters getConnectionParameters(String data)
          Template method for sub-classes to provide the implementation of how to handle the 'pulse' message received from a peer IConnectionDiscoverer.
protected  AsyncLog getLog()
          Get the log to use for the object hierarchy
protected  String getProtocolConnectionParameters()
          Overridden by subclasses to provide the protocol specific parameters for connecting to the connection broker of this context.
 
Methods inherited from class fulmine.distribution.connection.AbstractConnectionDiscoverer
connectionDestroyed, disablePulsing, doDestroy, enablePulsing, getAllowableNetworkHeartbeatMissCount, getNetwork, getNetworkHeartbeatPeriod, getPort, getPulse, getSocket, isPulseFromContext, isPulsingEnabled, pulse, send, setAllowableNetworkHeartbeatMissCount, setNetworkHeartbeatPeriod, toString
 
Methods inherited from class fulmine.AbstractLifeCycle
checkActive, destroy, finalize, isActive, start
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface fulmine.distribution.connection.IConnectionDiscoverer
connectionDestroyed, disablePulsing, enablePulsing, pulse, start
 
Methods inherited from interface fulmine.ILifeCycle
isActive
 
Methods inherited from interface fulmine.IDestroyable
destroy
 
Methods inherited from interface fulmine.distribution.IHeartbeatMonitor
getAllowableNetworkHeartbeatMissCount, getNetworkHeartbeatPeriod, setAllowableNetworkHeartbeatMissCount, setNetworkHeartbeatPeriod
 

Constructor Detail

TcpConnectionDiscoverer

public TcpConnectionDiscoverer(IFrameworkContext context,
                               String hostAddress,
                               int tcpPort,
                               String udpNetwork,
                               int udpPort,
                               String udpNic)
Constructs the discoverer with specific UDP binding parameters and extracts the TCP connection details from the broker

Parameters:
context - the local context
hostAddress - the host for the TCP connection the context exposes
tcpPort - the TCP port for the connection the context exposes
udpNetwork - the UDP network for discovery operations
udpPort - the UDP port for discovery operations
udpNic - the network interface card name to bind to, null for default
Method Detail

getLog

protected AsyncLog getLog()
Description copied from class: AbstractLifeCycle
Get the log to use for the object hierarchy

Overrides:
getLog in class AbstractConnectionDiscoverer
Returns:
the log to use for the object hierarchy

doStart

protected final void doStart()
Description copied from class: AbstractLifeCycle
Overridden in subclasses to perform custom logic on activation. Any exceptions should be thrown as a RuntimeException or subclass thereof. When this method is called, the AbstractLifeCycle.isActive() method will return true.

Overrides:
doStart in class AbstractConnectionDiscoverer

getConnectionParameters

protected IConnectionParameters getConnectionParameters(String data)
Description copied from class: AbstractConnectionDiscoverer
Template method for sub-classes to provide the implementation of how to handle the 'pulse' message received from a peer IConnectionDiscoverer. This method inspects the data string and creates an appropriate IConnectionParameters instance representing it.

Specified by:
getConnectionParameters in class AbstractConnectionDiscoverer
Parameters:
data - the pulse message from a peer IConnectionDiscoverer
Returns:
the IConnectionParameters extracted from the pulse message or null if the message could not be deciphered.

getProtocolConnectionParameters

protected String getProtocolConnectionParameters()
Description copied from class: AbstractConnectionDiscoverer
Overridden by subclasses to provide the protocol specific parameters for connecting to the connection broker of this context. The parameters must be delimited using ProtocolMessageConstants.DELIMITER. There is no need to prepend the delimiter.

Specified by:
getProtocolConnectionParameters in class AbstractConnectionDiscoverer
Returns:
a string of parameters for the connection protocol of the connection broker, delimited using ProtocolMessageConstants.DELIMITER


Copyright © 2007-2009. All Rights Reserved.