Rio Project 4.2 API Documentation



org.rioproject.fdh
Class HeartbeatFaultDetectionHandler

java.lang.Object
  extended by org.rioproject.fdh.AbstractFaultDetectionHandler
      extended by org.rioproject.fdh.HeartbeatFaultDetectionHandler
All Implemented Interfaces:
FaultDetectionHandler<ServiceID>

public class HeartbeatFaultDetectionHandler
extends AbstractFaultDetectionHandler

The HeartbeatFaultDetectionHandler is used to monitor services that implement the MonitorableService interface.

The HeartbeatFaultDetectionHandler creates a server socket and listens for notifications from the service for the service's reachability. If the service fails to provide a heartbeat notification within the timeframe specified, the HeartbeatFaultDetectionHandler will notify FaultDetectionListener instances of the failure.

Additionally, the HeartbeatFaultDetectionHandler will register with Lookup Services for ServiceRegistrar.TRANSITION_MATCH_NOMATCH transitions for the service being monitored. If the service is adminstratively removed from the network, or the service monitoring lease is between lease renewal points and the service has actually been removed from the network, the transition will be noted and FaultDetectionListener instances will be notified of the failure.

If the service does not implement the org.rioproject.core.MonitorableService interface, the HeartbeatFaultDetectionHandler will not perform heartbeat monitoring, but will only create the event consumer for Lookup Service TRANSITION_MATCH_NOMATCH transitions.

Configuring HeartbeatFautDetectionHandler

This implementation of HeartbeatFautDetectionHandler supports the following configuration entries; where each configuration entry name is associated with the component name org.rioproject.fdh.HeartbeatFautDetectionHandler.

Author:
Dennis Reedy

Nested Class Summary
 
Nested classes/interfaces inherited from class org.rioproject.fdh.AbstractFaultDetectionHandler
AbstractFaultDetectionHandler.ServiceMonitor
 
Field Summary
static String HEARTBEAT_GRACE_PERIOD_KEY
           
static String HEARTBEAT_PERIOD_KEY
           
static String SERVER_SOCKET_KEY
           
 
Fields inherited from class org.rioproject.fdh.AbstractFaultDetectionHandler
config, configArgs, DEFAULT_RETRY_COUNT, DEFAULT_RETRY_TIMEOUT, proxy, RETRY_COUNT_KEY, RETRY_TIMEOUT_KEY, retryCount, retryTimeout, serviceMonitor, terminating
 
Constructor Summary
HeartbeatFaultDetectionHandler()
           
 
Method Summary
protected  AbstractFaultDetectionHandler.ServiceMonitor getServiceMonitor()
          Override parent's getServiceMonitor() method to create the ServiceLeaseManager
 void monitor(Object proxy, ServiceID id, LookupCache lCache)
          Begin monitoring the service
 void setConfiguration(String[] configArgs)
          Set configuration attributes for the FaultDetectionHandler.
 void setHeartbeatGracePeriod(long heartbeatGracePeriod)
           
 void setHeartbeatPeriod(long heartbeatPeriod)
           
 void terminate()
          Terminate the FaultDetectionHandler
 
Methods inherited from class org.rioproject.fdh.AbstractFaultDetectionHandler
getName, notifyListeners, register, setRetryCount, setRetryTimeout, unregister
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERVER_SOCKET_KEY

public static final String SERVER_SOCKET_KEY
See Also:
Constant Field Values

HEARTBEAT_PERIOD_KEY

public static final String HEARTBEAT_PERIOD_KEY
See Also:
Constant Field Values

HEARTBEAT_GRACE_PERIOD_KEY

public static final String HEARTBEAT_GRACE_PERIOD_KEY
See Also:
Constant Field Values
Constructor Detail

HeartbeatFaultDetectionHandler

public HeartbeatFaultDetectionHandler()
Method Detail

setConfiguration

public void setConfiguration(String[] configArgs)
Description copied from interface: FaultDetectionHandler
Set configuration attributes for the FaultDetectionHandler.

Parameters:
configArgs - Configuration attributes a FaultDetectionHandler will use to monitor the service. Values are specific to a concrete instance of the FaultDetectionHandler
See Also:
FaultDetectionHandler.setConfiguration(java.lang.String[])

monitor

public void monitor(Object proxy,
                    ServiceID id,
                    LookupCache lCache)
             throws Exception
Description copied from interface: FaultDetectionHandler
Begin monitoring the service

Specified by:
monitor in interface FaultDetectionHandler<ServiceID>
Overrides:
monitor in class AbstractFaultDetectionHandler
Parameters:
proxy - The service that the FaultDetectionHandler will monitor
id - An Object representing a unique service identifier for the service being monitored.
lCache - A LookupCache instance to be used to be notified of service transition events from a Jini Lookup Service
Throws:
Exception - If there are abnormal conditions encountered
See Also:
FaultDetectionHandler.monitor(java.lang.Object, T, net.jini.lookup.LookupCache)

getServiceMonitor

protected AbstractFaultDetectionHandler.ServiceMonitor getServiceMonitor()
                                                                  throws Exception
Override parent's getServiceMonitor() method to create the ServiceLeaseManager

Specified by:
getServiceMonitor in class AbstractFaultDetectionHandler
Returns:
A ServiceMonitor
Throws:
Exception - if the ServiceMonitor cannot be created

terminate

public void terminate()
Description copied from interface: FaultDetectionHandler
Terminate the FaultDetectionHandler

Specified by:
terminate in interface FaultDetectionHandler<ServiceID>
Overrides:
terminate in class AbstractFaultDetectionHandler
See Also:
FaultDetectionHandler.terminate()

setHeartbeatPeriod

public void setHeartbeatPeriod(long heartbeatPeriod)

setHeartbeatGracePeriod

public void setHeartbeatGracePeriod(long heartbeatGracePeriod)

Copyright © Rio Project.

Copyright © 2006-2011 Rio Project. All Rights Reserved.