com.caucho.cloud.network
Class ClusterServer

java.lang.Object
  extended by com.caucho.cloud.network.ClusterServer

public final class ClusterServer
extends java.lang.Object

Defines a member of the cluster, corresponds to in the conf file. A ServerConnector obtained with #getServerConnector is used to actually communicate with this ClusterServer when it is active in another instance of Resin .


Method Summary
 void add(ProtocolPort protocolPort)
           
 void addContentProgram(ConfigProgram program)
          Adds a program.
 void addHttp(TcpSocketLinkListener listener)
           
 void addListen(TcpSocketLinkListener listener)
           
 void addListenDefault(ConfigProgram program)
          Adds a listen-default
 void addPingUrl(java.lang.String url)
          Adds a ping url for availability testing
 void addPortDefault(ContainerProgram program)
          Adds a port-default
 void close()
          Close any ports.
 TcpSocketLinkListener createHttp()
           
 TcpSocketLinkListener createListen()
           
 TcpSocketLinkListener createProtocol()
           
static int decode(int code)
           
 void generateIdPrefix(java.lang.StringBuilder cb)
          Adds the primary/backup/third digits to the id.
 java.lang.String getAddress()
          Gets the address
 ClusterServerMXBean getAdmin()
          Returns the admin object
 java.lang.String getBamAdminName()
          Returns the bam name
 CloudPod getCloudPod()
          Returns the owning pod
 CloudServer getCloudServer()
           
 CloudCluster getCluster()
          Returns the cluster.
 long getClusterIdleTime()
          The cluster idle-time.
 ClientSocketFactory getClusterSocketPool()
          Returns the socket pool as a pod cluster connector.
static ClusterServer getCurrent()
           
 java.lang.String getDebugId()
           
 java.lang.String getId()
          Gets the server identifier.
 int getIndex()
          Returns the server index within the pod.
 long getLastHeartbeatTime()
           
 java.util.ArrayList<TcpSocketLinkListener> getListeners()
           
 int getLoadBalanceConnectionMin()
          The minimum number of load balance connections for green load balancing.
 long getLoadBalanceConnectTimeout()
          Gets the loadBalance connection time.
 long getLoadBalanceIdleTime()
          Sets the loadBalance idle-time.
 long getLoadBalanceRecoverTime()
          Gets the loadBalance fail-recover-time.
 ClientSocketFactory getLoadBalanceSocketPool()
          Returns the socket pool as a load-balancer.
 long getLoadBalanceSocketTimeout()
          Gets the loadBalance socket time.
 long getLoadBalanceWarmupTime()
          Gets the loadBalance warmup time
 int getLoadBalanceWeight()
          Gets the loadBalance weight
 java.util.ArrayList<java.lang.String> getPingUrlList()
          Returns the ping url list
 int getPort()
          Gets the port.
 ConfigProgram getPortDefaults()
          Returns the port defaults for the Server
 java.lang.String getServerClusterId()
          Returns the server's id within the cluster
 java.lang.String getServerDomainId()
          Returns the server's id within all Resin clusters
 ConfigProgram getServerProgram()
          Returns the configuration program for the Server.
 java.lang.String getStage()
           
 long getStateTimestamp()
          Returns the last state change timestamp.
 TriadOwner getTriadOwner()
          Returns the pod owner
 void init()
          Initialize
 boolean isActiveRemote()
          Returns true if the server is remote and active.
 boolean isBackup()
           
 boolean isDynamic()
          True for a dynamic server
 boolean isHeartbeatActive()
          Test if the server is active, i.e.
 boolean isRemote()
           
 boolean isRemotePod()
           
 boolean isSelf()
          Returns true for the self server
 boolean isSSL()
           
 boolean isTriad()
          Returns true if this server is a triad.
 boolean notifyHeartbeatStart()
          Notify that a start event has been received.
 boolean notifyHeartbeatStop()
          Notify that a stop event has been received.
 void setAcceptListenBacklog(ConfigProgram program)
          Sets the socket's listen property
 void setAcceptThreadMax(ConfigProgram program)
          Sets the maximum spare listen.
 void setAcceptThreadMin(ConfigProgram program)
          Sets the minimum spare listen.
 void setBackup(boolean isBackup)
          Sets true for backups
 void setConnectionMax(ConfigProgram program)
          Sets the maximum connections per port
 void setKeepaliveConnectionTimeMax(ConfigProgram program)
          Sets the keepalive connection timeout
 void setKeepaliveMax(ConfigProgram program)
          Sets the maximum keepalive
 void setKeepaliveSelectEnable(ConfigProgram program)
          Sets the select-based keepalive timeout
 void setKeepaliveSelectMax(ConfigProgram program)
          Sets the select-based keepalive timeout
 void setKeepaliveSelectThreadTimeout(ConfigProgram program)
          Sets the select-based keepalive timeout
 void setKeepaliveTimeout(ConfigProgram program)
          Sets the keepalive timeout
 void setLoadBalanceConnectionMin(int min)
          The minimum number of load balance connections for green load balancing.
 void setLoadBalanceConnectTimeout(Period period)
          Sets the loadBalance connection time.
 void setLoadBalanceIdleTime(Period period)
          Sets the loadBalance max-idle-time.
 void setLoadBalanceRecoverTime(Period period)
          Sets the loadBalance fail-recover-time.
 void setLoadBalanceSocketTimeout(Period period)
          Sets the loadBalance socket time.
 void setLoadBalanceWarmupTime(Period period)
          Sets the loadBalance warmup time
 void setLoadBalanceWeight(int weight)
          Sets the loadBalance weight
 void setSocketTimeout(ConfigProgram program)
          Sets the suspend timeout
 void setStage(java.lang.String stage)
           
 void setSuspendTimeMax(ConfigProgram program)
          Sets the suspend timeout
 void stopServer()
          Starts the server.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getCurrent

public static ClusterServer getCurrent()

getId

public java.lang.String getId()
Gets the server identifier.


getDebugId

public java.lang.String getDebugId()

getCloudServer

public CloudServer getCloudServer()

getServerClusterId

public java.lang.String getServerClusterId()
Returns the server's id within the cluster


getServerDomainId

public java.lang.String getServerDomainId()
Returns the server's id within all Resin clusters


getBamAdminName

public java.lang.String getBamAdminName()
Returns the bam name


getCluster

public CloudCluster getCluster()
Returns the cluster.


getCloudPod

public CloudPod getCloudPod()
Returns the owning pod


isTriad

public boolean isTriad()
Returns true if this server is a triad.


getTriadOwner

public TriadOwner getTriadOwner()
Returns the pod owner


getIndex

public int getIndex()
Returns the server index within the pod.


getAddress

public java.lang.String getAddress()
Gets the address


isSSL

public boolean isSSL()

setBackup

public void setBackup(boolean isBackup)
Sets true for backups


isBackup

public boolean isBackup()

isDynamic

public boolean isDynamic()
True for a dynamic server


setLoadBalanceConnectTimeout

public void setLoadBalanceConnectTimeout(Period period)
Sets the loadBalance connection time.


getLoadBalanceConnectTimeout

public long getLoadBalanceConnectTimeout()
Gets the loadBalance connection time.


setLoadBalanceConnectionMin

@Configurable
public void setLoadBalanceConnectionMin(int min)
The minimum number of load balance connections for green load balancing.


getLoadBalanceConnectionMin

public int getLoadBalanceConnectionMin()
The minimum number of load balance connections for green load balancing.


setLoadBalanceSocketTimeout

public void setLoadBalanceSocketTimeout(Period period)
Sets the loadBalance socket time.


getLoadBalanceSocketTimeout

public long getLoadBalanceSocketTimeout()
Gets the loadBalance socket time.


setLoadBalanceIdleTime

public void setLoadBalanceIdleTime(Period period)
Sets the loadBalance max-idle-time.


getLoadBalanceIdleTime

public long getLoadBalanceIdleTime()
Sets the loadBalance idle-time.


setLoadBalanceRecoverTime

public void setLoadBalanceRecoverTime(Period period)
Sets the loadBalance fail-recover-time.


getLoadBalanceRecoverTime

public long getLoadBalanceRecoverTime()
Gets the loadBalance fail-recover-time.


getClusterIdleTime

public long getClusterIdleTime()
The cluster idle-time.


createHttp

@Configurable
public TcpSocketLinkListener createHttp()
                                 throws ConfigException
Throws:
ConfigException

addHttp

public void addHttp(TcpSocketLinkListener listener)

createProtocol

@Configurable
public TcpSocketLinkListener createProtocol()

createListen

@Configurable
public TcpSocketLinkListener createListen()

addListen

public void addListen(TcpSocketLinkListener listener)

add

@Configurable
public void add(ProtocolPort protocolPort)

getListeners

public java.util.ArrayList<TcpSocketLinkListener> getListeners()

addPortDefault

@Configurable
public void addPortDefault(ContainerProgram program)
Adds a port-default


addListenDefault

@Configurable
public void addListenDefault(ConfigProgram program)
Adds a listen-default


setAcceptListenBacklog

public void setAcceptListenBacklog(ConfigProgram program)
Sets the socket's listen property


setAcceptThreadMin

public void setAcceptThreadMin(ConfigProgram program)
                        throws ConfigException
Sets the minimum spare listen.

Throws:
ConfigException

setAcceptThreadMax

public void setAcceptThreadMax(ConfigProgram program)
                        throws ConfigException
Sets the maximum spare listen.

Throws:
ConfigException

setConnectionMax

public void setConnectionMax(ConfigProgram program)
Sets the maximum connections per port


setKeepaliveMax

public void setKeepaliveMax(ConfigProgram program)
Sets the maximum keepalive


setKeepaliveTimeout

public void setKeepaliveTimeout(ConfigProgram program)
Sets the keepalive timeout


setKeepaliveConnectionTimeMax

public void setKeepaliveConnectionTimeMax(ConfigProgram program)
Sets the keepalive connection timeout


setKeepaliveSelectEnable

public void setKeepaliveSelectEnable(ConfigProgram program)
Sets the select-based keepalive timeout


setKeepaliveSelectMax

public void setKeepaliveSelectMax(ConfigProgram program)
Sets the select-based keepalive timeout


setKeepaliveSelectThreadTimeout

public void setKeepaliveSelectThreadTimeout(ConfigProgram program)
Sets the select-based keepalive timeout


setSocketTimeout

public void setSocketTimeout(ConfigProgram program)
Sets the suspend timeout


setSuspendTimeMax

public void setSuspendTimeMax(ConfigProgram program)
Sets the suspend timeout


setStage

public void setStage(java.lang.String stage)

getStage

public java.lang.String getStage()

addPingUrl

public void addPingUrl(java.lang.String url)
Adds a ping url for availability testing


getPingUrlList

public java.util.ArrayList<java.lang.String> getPingUrlList()
Returns the ping url list


setLoadBalanceWarmupTime

public void setLoadBalanceWarmupTime(Period period)
Sets the loadBalance warmup time


getLoadBalanceWarmupTime

public long getLoadBalanceWarmupTime()
Gets the loadBalance warmup time


setLoadBalanceWeight

public void setLoadBalanceWeight(int weight)
Sets the loadBalance weight


getLoadBalanceWeight

public int getLoadBalanceWeight()
Gets the loadBalance weight


getPort

public int getPort()
Gets the port.


isSelf

public boolean isSelf()
Returns true for the self server


isRemote

public boolean isRemote()

getClusterSocketPool

public final ClientSocketFactory getClusterSocketPool()
Returns the socket pool as a pod cluster connector.


getLoadBalanceSocketPool

public final ClientSocketFactory getLoadBalanceSocketPool()
Returns the socket pool as a load-balancer.


isActiveRemote

public final boolean isActiveRemote()
Returns true if the server is remote and active.


addContentProgram

@Configurable
public void addContentProgram(ConfigProgram program)
Adds a program.


getServerProgram

public ConfigProgram getServerProgram()
Returns the configuration program for the Server.


getPortDefaults

public ConfigProgram getPortDefaults()
Returns the port defaults for the Server


init

public void init()
Initialize


isRemotePod

public boolean isRemotePod()

isHeartbeatActive

public boolean isHeartbeatActive()
Test if the server is active, i.e. has received an active message.


getStateTimestamp

public long getStateTimestamp()
Returns the last state change timestamp.


getLastHeartbeatTime

public long getLastHeartbeatTime()

notifyHeartbeatStart

public boolean notifyHeartbeatStart()
Notify that a start event has been received.


notifyHeartbeatStop

public boolean notifyHeartbeatStop()
Notify that a stop event has been received.


stopServer

public void stopServer()
Starts the server.


generateIdPrefix

public void generateIdPrefix(java.lang.StringBuilder cb)
Adds the primary/backup/third digits to the id.


getAdmin

public ClusterServerMXBean getAdmin()
Returns the admin object


close

public void close()
Close any ports.


toString

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

decode

public static int decode(int code)