com.caucho.server.cluster
Class ClusterServer

java.lang.Object
  extended by com.caucho.server.cluster.ClusterServer

public 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(Cluster cluster)
           
ClusterServer(Cluster cluster, boolean test)
           
ClusterServer(Machine machine)
           
 
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 addPortDefault(ContainerProgram program)
          Adds a port default
 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 bind(java.lang.String address, int port, QServerSocket ss)
          Pre-binding of ports.
 void close()
          Close any ports.
 ClusterPort createClusterPort()
          Sets the ClusterPort.
 Port createHttp()
          Adds a http.
 Port createProtocol()
          Adds a custom-protocol port.
 long generateBackupCode()
          Generate the primary, secondary, tertiary, returning the value encoded in a long.
 void generateBackupCode(java.lang.StringBuilder cb)
          Adds the primary/backup/third digits to the id.
 ClusterServerMXBean getAdmin()
          Returns the admin object
 Cluster getCluster()
          Returns the cluster.
 ClusterPort getClusterPort()
          Sets the ClusterPort.
 java.lang.String getId()
          Gets the server identifier.
 int getIndex()
          Returns the server index.
 long getKeepaliveTimeout()
          Gets the keepalive timeout.
 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.
 int getPort()
          Gets the port.
 java.util.ArrayList<Port> getPorts()
          Returns the ports.
 ServerPool getServerPool()
          Returns the server connector.
 ConfigProgram getServerProgram()
          Adds a program.
 long getSocketTimeout()
          Gets the loadBalance read/write timeout
 void init()
          Initialize
 boolean isDynamic()
          True for a dynamic server
 boolean isSelf()
          Returns true for the self server
 boolean isSSL()
          Returns true for secure.
 void setAddress(java.lang.String address)
          Sets the address
 void setBackup(boolean isBackup)
          Sets true for backups
 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 setKeepaliveTimeout(Period timeout)
          Sets the keepalive timeout.
 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 setPort(int port)
          Sets a port.
 void setSocketTimeout(Period period)
          Sets the loadBalance read/write timeout
 void setUserName(java.lang.String userName)
          Sets the user name.
 Server startServer()
          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(Cluster cluster)

ClusterServer

public ClusterServer(Machine machine)

ClusterServer

public ClusterServer(Cluster cluster,
                     boolean test)
Method Detail

getId

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


setId

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


getCluster

public Cluster getCluster()
Returns the cluster.


getMachine

public Machine getMachine()
Returns the machine.


getIndex

public int getIndex()
Returns the server index.


setKeepaliveTimeout

public void setKeepaliveTimeout(Period timeout)
Sets the keepalive timeout.


getKeepaliveTimeout

public long getKeepaliveTimeout()
Gets the keepalive timeout.


setAddress

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

Throws:
java.net.UnknownHostException

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.


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.


setSocketTimeout

public void setSocketTimeout(Period period)
Sets the loadBalance read/write timeout


getSocketTimeout

public long getSocketTimeout()
Gets the loadBalance read/write timeout


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.


addPortDefault

public void addPortDefault(ContainerProgram program)
Adds a port default


createHttp

public Port createHttp()
                throws ConfigException
Adds a http.

Throws:
ConfigException

createProtocol

public Port createProtocol()
                    throws ConfigException
Adds a custom-protocol port.

Throws:
ConfigException

bind

public void bind(java.lang.String address,
                 int port,
                 QServerSocket ss)
          throws java.lang.Exception
Pre-binding of ports.

Throws:
java.lang.Exception

setUserName

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


setGroupName

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


getPorts

public java.util.ArrayList<Port> getPorts()
Returns the ports.


createClusterPort

public ClusterPort createClusterPort()
Sets the ClusterPort.


getClusterPort

public ClusterPort getClusterPort()
Sets the ClusterPort.


isSelf

public boolean isSelf()
Returns true for the self server


isSSL

public boolean isSSL()
Returns true for secure.


getServerPool

public ServerPool getServerPool()
Returns the server connector.


addContentProgram

public void addContentProgram(ConfigProgram program)
Adds a program.


getServerProgram

public ConfigProgram getServerProgram()
Adds a program.


init

public void init()
          throws java.lang.Exception
Initialize

Throws:
java.lang.Exception

startServer

public Server startServer()
                   throws StartLifecycleException
Starts the server.

Throws:
StartLifecycleException

generateBackupCode

public long generateBackupCode()
Generate the primary, secondary, tertiary, returning the value encoded in a long.


generateBackupCode

public void generateBackupCode(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