com.caucho.server.cluster
Class ClusterServer

java.lang.Object
  extended by com.caucho.server.cluster.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 .


Constructor Summary
ClusterServer(ClusterPod pod, int index)
           
 
Method Summary
 void addContentProgram(ConfigProgram program)
          Adds a program.
 void addJavaExe(java.lang.String args)
          Arguments on boot
 void addJvmArg(java.lang.String args)
          Arguments on boot
 void addJvmClasspath(java.lang.String args)
          Arguments on boot
 void addPingUrl(java.lang.String url)
          Adds a ping url for availability testing
 void addPortDefault(ContainerProgram program)
           
 void addWatchdogAddress(java.lang.String addr)
          Arguments on boot
 void addWatchdogArg(java.lang.String args)
          Arguments on boot
 void addWatchdogJvmArg(java.lang.String args)
          Arguments on boot
 void addWatchdogPassword(java.lang.String args)
          Arguments on boot
 void addWatchdogPort(int port)
          Arguments on boot
 void close()
          Close any ports.
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
 Cluster getCluster()
          Returns the cluster.
 ClusterPod getClusterPod()
          Returns the owning pod
 java.lang.String getDebugId()
           
 ActorStream getHmtpStream()
          Returns the bam queue to the server.
 java.lang.String getId()
          Gets the server identifier.
 int getIndex()
          Returns the server index within the pod.
 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.
 long getLoadBalanceSocketTimeout()
          Gets the loadBalance socket time.
 long getLoadBalanceWarmupTime()
          Gets the loadBalance warmup time
 int getLoadBalanceWeight()
          Gets the loadBalance weight
 Machine getMachine()
          Returns the machine.
 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
 ServerPool getServerPool()
          Returns the server connector.
 ConfigProgram getServerProgram()
          Returns the configuration program for the Server.
 long getStateTimestamp()
          Returns the last state change timestamp.
 ClusterPod.Owner getTriadOwner()
          Returns the pod owner
 void init()
          Initialize
 boolean isActive()
          Test if the server is active, i.e.
 boolean isActiveRemote()
          Returns true if the server is remote and active.
 boolean isDynamic()
          True for a dynamic server
 boolean isSelf()
          Returns true for the self server
 boolean isSSL()
           
 boolean isTriad()
          Returns true if this server is a triad.
 boolean notifyStart(long timestamp)
          Notify that a start event has been received.
 boolean notifyStop(long timestamp)
          Notify that a start 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 setAddress(java.lang.String address)
          Sets the address
 void setBackup(boolean isBackup)
          Sets true for backups
 void setConnectionMax(ConfigProgram program)
          Sets the maximum connections per port
 void setDynamic(boolean isDynamic)
          True for a dynamic server
 void setGroupName(java.lang.String groupName)
          Sets the group name.
 void setId(java.lang.String id)
          Sets the server identifier.
 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
protected  void setMachine(Machine machine)
          Returns the machine.
 void setPort(int port)
          Sets a port.
 void setSocketTimeout(ConfigProgram program)
          Sets the suspend timeout
 void setSuspendTimeMax(ConfigProgram program)
          Sets the suspend timeout
 void setUserName(java.lang.String userName)
          Sets the user name.
 Server startServer()
          Starts the server.
 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
 

Constructor Detail

ClusterServer

public ClusterServer(ClusterPod pod,
                     int index)
Method Detail

getId

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


setId

public void setId(java.lang.String id)
Sets the server identifier.


getDebugId

public java.lang.String getDebugId()

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 Cluster getCluster()
Returns the cluster.


getMachine

public Machine getMachine()
Returns the machine.


setMachine

protected void setMachine(Machine machine)
Returns the machine.


getClusterPod

public ClusterPod getClusterPod()
Returns the owning pod


isTriad

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


getTriadOwner

public ClusterPod.Owner getTriadOwner()
Returns the pod owner


getIndex

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


setAddress

@Configurable
public void setAddress(java.lang.String address)
                throws java.net.UnknownHostException
Sets the address

Throws:
java.net.UnknownHostException

getAddress

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


isSSL

public boolean isSSL()

setBackup

public void setBackup(boolean isBackup)
Sets true for backups


setDynamic

public void setDynamic(boolean isDynamic)
True for a dynamic server


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.


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


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


addJavaExe

public void addJavaExe(java.lang.String args)
Arguments on boot


addJvmArg

public void addJvmArg(java.lang.String args)
Arguments on boot


addJvmClasspath

public void addJvmClasspath(java.lang.String args)
Arguments on boot


addWatchdogArg

public void addWatchdogArg(java.lang.String args)
Arguments on boot


addWatchdogJvmArg

public void addWatchdogJvmArg(java.lang.String args)
Arguments on boot


addWatchdogPassword

public void addWatchdogPassword(java.lang.String args)
Arguments on boot


addWatchdogPort

public void addWatchdogPort(int port)
Arguments on boot


addWatchdogAddress

public void addWatchdogAddress(java.lang.String addr)
Arguments on boot


setPort

public void setPort(int port)
Sets a port.


getPort

public int getPort()
Gets the port.


setUserName

public void setUserName(java.lang.String userName)
Sets the user name.


setGroupName

public void setGroupName(java.lang.String groupName)
Sets the group name.


isSelf

public boolean isSelf()
Returns true for the self server


getServerPool

public final ServerPool getServerPool()
Returns the server connector.


getHmtpStream

public ActorStream getHmtpStream()
Returns the bam queue to the server.


isActiveRemote

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


addPortDefault

public void addPortDefault(ContainerProgram program)

addContentProgram

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


isActive

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


getStateTimestamp

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


notifyStart

public boolean notifyStart(long timestamp)
Notify that a start event has been received.


notifyStop

public boolean notifyStop(long timestamp)
Notify that a start event has been received.


startServer

public Server startServer()
                   throws StartLifecycleException
Starts the server.

Throws:
StartLifecycleException

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)