org.glassfish.gms.bootstrap
Class HealthHistory

java.lang.Object
  extended by org.glassfish.gms.bootstrap.HealthHistory
All Implemented Interfaces:
org.jvnet.hk2.config.ConfigListener

public final class HealthHistory
extends java.lang.Object
implements org.jvnet.hk2.config.ConfigListener

Used to hold cluster history. This information is backed by a ConcurrentMap, so iterating over the instances is "weakly consistent" as the state could change at any time (especially during cluster startup).


Nested Class Summary
static class HealthHistory.InstanceHealth
           
static class HealthHistory.STATE
           
 
Field Summary
static long NOTIME
          Used when no time information is known, for instance at cluster startup before an instance has started.
 
Constructor Summary
HealthHistory(Cluster cluster)
          Creates a health history that knows about the expected list of instances.
HealthHistory(java.lang.String instanceName, boolean keepFormerMembers)
          Creates a health history that contains only the given instance.
 
Method Summary
 org.jvnet.hk2.config.UnprocessedChangeEvents changed(java.beans.PropertyChangeEvent[] events)
           
 HealthHistory.InstanceHealth getHealthByInstance(java.lang.String name)
          Returns the state/time of a specific instance.
 java.util.Set<java.lang.String> getInstances()
          Returns a copy of the instance names.
 java.util.List<java.lang.String> getInstancesByState(HealthHistory.STATE targetState)
          The returned list may be modified without affecting the information in the HealthHistory object.
 void updateHealth(com.sun.enterprise.ee.cms.core.Signal signal)
          Called by GMS subsystem to update the health of an instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NOTIME

public static final long NOTIME
Used when no time information is known, for instance at cluster startup before an instance has started.

See Also:
Constant Field Values
Constructor Detail

HealthHistory

public HealthHistory(Cluster cluster)
Creates a health history that knows about the expected list of instances. This is called from the GMS adapter during initialization.

Parameters:
cluster - Cluster config object containing the instances

HealthHistory

public HealthHistory(java.lang.String instanceName,
                     boolean keepFormerMembers)
Creates a health history that contains only the given instance. This is used in the dynamic cluster case, and so a param is passed in to tell us whether or not we should keep instances that are no longer running.

Parameters:
instanceName - The name of the instance to add to the health table
keepFormerMembers - Specifies whether or not to keep former group members in the table when they have failed or stopped. This value should normally be false for a user-managed cluster unless the history is needed for testing or debugging.
Method Detail

getHealthByInstance

public HealthHistory.InstanceHealth getHealthByInstance(java.lang.String name)
Returns the state/time of a specific instance.

Parameters:
name - Name of the instance
Returns:
The instance health

getInstancesByState

public java.util.List<java.lang.String> getInstancesByState(HealthHistory.STATE targetState)
The returned list may be modified without affecting the information in the HealthHistory object.

Parameters:
targetState - The desired state of the instances
Returns:
A list containing the names of the instances

getInstances

public java.util.Set<java.lang.String> getInstances()
Returns a copy of the instance names.

Returns:
An unmodifiable set of the instance names

updateHealth

public void updateHealth(com.sun.enterprise.ee.cms.core.Signal signal)
Called by GMS subsystem to update the health of an instance.

Parameters:
signal - The GMS signal passed in from the GMS adapter that is managing this object

changed

public org.jvnet.hk2.config.UnprocessedChangeEvents changed(java.beans.PropertyChangeEvent[] events)
Specified by:
changed in interface org.jvnet.hk2.config.ConfigListener


Copyright © 2012 GlassFish Community. All Rights Reserved.