com.waveset.task
Class ServerRegistry

java.lang.Object
  extended bycom.waveset.task.ServerRegistry

public class ServerRegistry
extends java.lang.Object

Represents the set of Lighthouse servers that share a repository (typically, although not necessarily, clustered by an application server).

Each Lighthouse task scheduler records its heartbeat in the repository.

A host whose heartbeat is overdue beyond a configurable number of intervals can be declared legally dead.

Every active scheduler will periodically attempt to detect any newly failed server.

An active server that is shut down in an orderly manner will change its own state to inactive. Once an inactive server is restarted, its scheduler automatically re-registers the server, which changes its state back to active.

Neither an inactive server nor a failed server is automatically removed from the list of known servers. An administrator who intends to remove a server from the list of known servers must explicitly de-register that server.


Field Summary
static java.lang.String code_id
           
static java.lang.String DEAD_AFTER_INTERVALS
          The name of a SystemConfiguration property that specifies how many intervals one should wait before considering a server legally dead.
static long DEFAULT_DEAD_AFTER_INTERVALS
          Default value for DEAD_AFTER_INTERVALS.
static long DEFAULT_HEARTBEAT_INTERVAL
          Default value for HEARTBEAT_INTERVAL.
static java.lang.String HEARTBEAT_INTERVAL
          The name of a SystemConfiguration property that specifies how often a server's heartbeat is expected.
protected static Trace trace
           
 
Constructor Summary
ServerRegistry()
           
 
Method Summary
static void activate(LighthouseContext lh, java.lang.String serverName)
          Mark the ServerRegistry entry as ACTIVE for the specified server name.
static void deactivate(LighthouseContext lh, java.lang.String serverName)
          Mark the ServerRegistry entry as INACTIVE for the specified server name.
static void deRegister(LighthouseContext lh, java.lang.String serverName)
          Remove any ServerRegistry entry for the specified server name.
static java.util.List detectNewlyFailedServers(LighthouseContext lh)
           
static java.lang.String[] getActiveServers(LighthouseContext lh)
          Returns a list of all active servers.
static long getDeadAfterIntervals(LighthouseContext lh)
           
static long getHeartBeatIntervalSeconds(LighthouseContext lh)
          Common code.
static java.lang.String[] getKnownServers(LighthouseContext lh)
          Returns an array of known server names.
static java.lang.String[] getNewlyFailedServers(LighthouseContext lh)
          Returns a list of all the newly failed servers.
static java.util.List listActiveServers(LighthouseContext lh)
           
static java.util.List listKnownServers(LighthouseContext lh)
           
static void register(LighthouseContext lh, java.lang.String serverName)
          Add (or update the heartbeat in) a ServerRegistry entry for the specified server name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

code_id

public static final java.lang.String code_id
See Also:
Constant Field Values

trace

protected static final Trace trace

HEARTBEAT_INTERVAL

public static final java.lang.String HEARTBEAT_INTERVAL
The name of a SystemConfiguration property that specifies how often a server's heartbeat is expected.

See Also:
Constant Field Values

DEAD_AFTER_INTERVALS

public static final java.lang.String DEAD_AFTER_INTERVALS
The name of a SystemConfiguration property that specifies how many intervals one should wait before considering a server legally dead.

See Also:
Constant Field Values

DEFAULT_HEARTBEAT_INTERVAL

public static final long DEFAULT_HEARTBEAT_INTERVAL
Default value for HEARTBEAT_INTERVAL.

See Also:
Constant Field Values

DEFAULT_DEAD_AFTER_INTERVALS

public static final long DEFAULT_DEAD_AFTER_INTERVALS
Default value for DEAD_AFTER_INTERVALS.

See Also:
Constant Field Values
Constructor Detail

ServerRegistry

public ServerRegistry()
Method Detail

register

public static void register(LighthouseContext lh,
                            java.lang.String serverName)
                     throws WavesetException
Add (or update the heartbeat in) a ServerRegistry entry for the specified server name.

Throws:
WavesetException

activate

public static void activate(LighthouseContext lh,
                            java.lang.String serverName)
                     throws WavesetException
Mark the ServerRegistry entry as ACTIVE for the specified server name.

Throws:
WavesetException

deactivate

public static void deactivate(LighthouseContext lh,
                              java.lang.String serverName)
                       throws WavesetException
Mark the ServerRegistry entry as INACTIVE for the specified server name.

Throws:
WavesetException

deRegister

public static void deRegister(LighthouseContext lh,
                              java.lang.String serverName)
                       throws WavesetException
Remove any ServerRegistry entry for the specified server name.

Throws:
WavesetException

listActiveServers

public static java.util.List listActiveServers(LighthouseContext lh)
                                        throws WavesetException
Throws:
WavesetException

detectNewlyFailedServers

public static java.util.List detectNewlyFailedServers(LighthouseContext lh)
                                               throws WavesetException
Throws:
WavesetException

listKnownServers

public static java.util.List listKnownServers(LighthouseContext lh)
                                       throws WavesetException
Throws:
WavesetException

getHeartBeatIntervalSeconds

public static long getHeartBeatIntervalSeconds(LighthouseContext lh)
                                        throws WavesetException
Common code.

Throws:
WavesetException

getDeadAfterIntervals

public static long getDeadAfterIntervals(LighthouseContext lh)
                                  throws WavesetException
Throws:
WavesetException

getKnownServers

public static java.lang.String[] getKnownServers(LighthouseContext lh)
                                          throws WavesetException
Returns an array of known server names.

Throws:
WavesetException

getActiveServers

public static java.lang.String[] getActiveServers(LighthouseContext lh)
                                           throws WavesetException
Returns a list of all active servers.

Throws:
WavesetException

getNewlyFailedServers

public static java.lang.String[] getNewlyFailedServers(LighthouseContext lh)
                                                throws WavesetException
Returns a list of all the newly failed servers.

Throws:
WavesetException