com.caucho.cloud.network
Class NetworkClusterSystem

java.lang.Object
  extended by com.caucho.env.service.AbstractResinSubSystem
      extended by com.caucho.cloud.network.NetworkClusterSystem
All Implemented Interfaces:
ResinSubSystem
Direct Known Subclasses:
ProNetworkClusterSystem

public class NetworkClusterSystem
extends AbstractResinSubSystem

NetworkClusterService manages the cluster network code, the communication between Resin servers in a cluster.


Field Summary
static int START_PRIORITY
           
 
Fields inherited from interface com.caucho.env.service.ResinSubSystem
START_PRIORITY_CACHE_SERVICE, START_PRIORITY_CLASSLOADER, START_PRIORITY_CLUSTER_SERVICE, START_PRIORITY_DEFAULT, START_PRIORITY_ENV_SYSTEM, START_PRIORITY_NETWORK_CLUSTER
 
Constructor Summary
NetworkClusterSystem(CloudServer selfServer)
           
 
Method Summary
 void addLinkListener(ClusterLinkListener listener)
           
 void addServerListener(ClusterServerListener listener)
           
static void createAndAddService(NetworkClusterSystem clusterSystem)
          Creates a new network cluster service.
 TcpSocketLinkListener getClusterListener()
          Returns the cluster port.
static NetworkClusterSystem getCurrent()
          Returns the current network service.
static CloudServer getCurrentSelfServer()
          Returns the current network service.
static java.util.ArrayList<java.net.InetAddress> getLocalAddresses()
           
 java.lang.String getLocalSocketAddress(ClusterServer clusterServer)
          Returns the local ip address for a server configured with external-address.
 CloudServer getSelfServer()
          Returns the self server for the network.
 java.lang.String getServerId()
          Returns the active server id.
 int getStartPriority()
          Returns the start priority of the service, used to determine which services to start first.
protected  void notifyHeartbeatStart(ClusterServer server)
           
protected  void notifyHeartbeatStop(ClusterServer server)
           
 void notifyLinkClose(java.lang.Object payload)
           
 void removeServerListener(com.caucho.cloud.network.NetworkClusterSystem.ServerListener listener)
           
 void start()
          Starts the service.
 void stop()
          Closes the server.
 java.lang.String toString()
           
 
Methods inherited from class com.caucho.env.service.AbstractResinSubSystem
destroy, getStopPriority, preCreate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

START_PRIORITY

public static final int START_PRIORITY
See Also:
Constant Field Values
Constructor Detail

NetworkClusterSystem

public NetworkClusterSystem(CloudServer selfServer)
Method Detail

createAndAddService

public static void createAndAddService(NetworkClusterSystem clusterSystem)
Creates a new network cluster service.


getCurrent

public static NetworkClusterSystem getCurrent()
Returns the current network service.


getCurrentSelfServer

public static CloudServer getCurrentSelfServer()
Returns the current network service.


getSelfServer

public CloudServer getSelfServer()
Returns the self server for the network.


getServerId

public java.lang.String getServerId()
Returns the active server id.


getClusterListener

public TcpSocketLinkListener getClusterListener()
Returns the cluster port.


addServerListener

public void addServerListener(ClusterServerListener listener)

removeServerListener

public void removeServerListener(com.caucho.cloud.network.NetworkClusterSystem.ServerListener listener)

notifyHeartbeatStart

protected void notifyHeartbeatStart(ClusterServer server)

notifyHeartbeatStop

protected void notifyHeartbeatStop(ClusterServer server)

addLinkListener

public void addLinkListener(ClusterLinkListener listener)

notifyLinkClose

public void notifyLinkClose(java.lang.Object payload)

getStartPriority

public int getStartPriority()
Description copied from interface: ResinSubSystem
Returns the start priority of the service, used to determine which services to start first.

Specified by:
getStartPriority in interface ResinSubSystem
Overrides:
getStartPriority in class AbstractResinSubSystem

start

public void start()
           throws java.lang.Exception
Description copied from interface: ResinSubSystem
Starts the service.

Specified by:
start in interface ResinSubSystem
Overrides:
start in class AbstractResinSubSystem
Throws:
java.lang.Exception

stop

public void stop()
          throws java.lang.Exception
Closes the server.

Specified by:
stop in interface ResinSubSystem
Overrides:
stop in class AbstractResinSubSystem
Throws:
java.lang.Exception

getLocalSocketAddress

public java.lang.String getLocalSocketAddress(ClusterServer clusterServer)
Returns the local ip address for a server configured with external-address.


getLocalAddresses

public static java.util.ArrayList<java.net.InetAddress> getLocalAddresses()

toString

public java.lang.String toString()
Overrides:
toString in class AbstractResinSubSystem