org.jboss.ha.timestamp
Class TimestampDiscrepancyValidationService

java.lang.Object
  extended by org.jboss.ha.timestamp.TimestampDiscrepancyValidationService
All Implemented Interfaces:
TimestampDiscrepancyObserver

public class TimestampDiscrepancyValidationService
extends Object
implements TimestampDiscrepancyObserver

Logs a WARN or ERROR when it determines that this node's system clock is out of sync with another node by more than a configurable amount. Whether a WARN or ERROR is logged is configurable.

Version:
$Revision: $
Author:
Brian Stansberry

Field Summary
static long DEFAULT_MAX_DISCREPANCY
          Default value for property maxDiscrepancy
 
Constructor Summary
TimestampDiscrepancyValidationService()
           
 
Method Summary
 boolean canRemoveDeadEntry(org.jboss.ha.framework.interfaces.ClusterNode dead, long lastChecked)
          Callback allowing the observer to veto the removal by the TimestampDiscrepancyService of discrepancy data for a node that is no longer active in the cluster.
 long getMaxDiscrepancy()
          Gets the maximum allowed potential discrepancy, in ms, between another server's clock and this server's clock.
 TimestampDiscrepancyService getTimestampDiscrepancyService()
           
 boolean getUseErrorLogging()
          Gets whether this object will log at ERROR level instead of WARN.
 void setMaxDiscrepancy(long maxDiscrepancy)
           
 void setTimestampDiscrepancyService(TimestampDiscrepancyService service)
           
 void setUseErrorLogging(boolean useErrorLogging)
          Sets whether this object will log at ERROR level instead of WARN.
 void start()
           
 void stop()
           
 void timestampDiscrepancyChanged(org.jboss.ha.framework.interfaces.ClusterNode node, TimestampDiscrepancy discrepancy)
          Notification from TimestampDiscrepancyService when it has changed the TimestampDiscrepancy associated with a particular node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_MAX_DISCREPANCY

public static final long DEFAULT_MAX_DISCREPANCY
Default value for property maxDiscrepancy

See Also:
Constant Field Values
Constructor Detail

TimestampDiscrepancyValidationService

public TimestampDiscrepancyValidationService()
Method Detail

getTimestampDiscrepancyService

public TimestampDiscrepancyService getTimestampDiscrepancyService()

setTimestampDiscrepancyService

public void setTimestampDiscrepancyService(TimestampDiscrepancyService service)

getMaxDiscrepancy

public long getMaxDiscrepancy()
Gets the maximum allowed potential discrepancy, in ms, between another server's clock and this server's clock. Default is DEFAULT_MAX_DISCREPANCY.

The potential discrepancy is the larger of the absolute value of TimestampDiscrepancy.getMinDiscrepancy() and the absolute value of TimestampDiscrepancy.getMaxDiscrepancy().

Returns:

setMaxDiscrepancy

public void setMaxDiscrepancy(long maxDiscrepancy)

getUseErrorLogging

public boolean getUseErrorLogging()
Gets whether this object will log at ERROR level instead of WARN.

Returns:
true if ERROR logging will be used.

setUseErrorLogging

public void setUseErrorLogging(boolean useErrorLogging)
Sets whether this object will log at ERROR level instead of WARN.

Parameters:
useErrorLogging - true if ERROR logging should be used.

start

public void start()

stop

public void stop()

canRemoveDeadEntry

public boolean canRemoveDeadEntry(org.jboss.ha.framework.interfaces.ClusterNode dead,
                                  long lastChecked)
Description copied from interface: TimestampDiscrepancyObserver
Callback allowing the observer to veto the removal by the TimestampDiscrepancyService of discrepancy data for a node that is no longer active in the cluster. Allows the observer to request that data for historically relevant nodes be retained.

Specified by:
canRemoveDeadEntry in interface TimestampDiscrepancyObserver
Parameters:
dead - the node
lastChecked - the time (in ms since the epoch) the caller was last able to obtain timestamp information from the caller
Returns:
true if the data can be removed, false if it must be retained.

timestampDiscrepancyChanged

public void timestampDiscrepancyChanged(org.jboss.ha.framework.interfaces.ClusterNode node,
                                        TimestampDiscrepancy discrepancy)
Description copied from interface: TimestampDiscrepancyObserver
Notification from TimestampDiscrepancyService when it has changed the TimestampDiscrepancy associated with a particular node.

Specified by:
timestampDiscrepancyChanged in interface TimestampDiscrepancyObserver
Parameters:
node - the node
discrepancy - the new discrepancy


Copyright © 2009 JBoss, a division of Red Hat, Inc.. All Rights Reserved.