Rio Project 4.2 API Documentation
org.rioproject.fdh
Class HeartbeatFaultDetectionHandler
java.lang.Object
org.rioproject.fdh.AbstractFaultDetectionHandler
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.
- serverSocket
Type:
|
java.net.ServerSocket |
Default:
|
new
java.net.ServerSocket(0)
|
Description:
|
Creates the ServerSocket instance with an anonymous port, which will
listen for service heartbeats |
- heartbeatPeriod
Type:
|
long |
Default:
|
1000*30 (30 seconds)
|
Description:
|
Indicates the amount of time (in
milliseconds) the hearbeat will be sent by the org.rioproject.core.MonitorableService to the HearbeatFaultDetectionHandler |
- heartbeatGracePeriod
Type:
|
long |
Default:
|
1000 (1 second)
|
Description:
|
The heartbeat grace period, that is the
maximum time (in milliseconds) outside of the period the Heartbeat will be
accepted before its determined as being late |
- Author:
- Dennis Reedy
| 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 |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
HeartbeatFaultDetectionHandler
public HeartbeatFaultDetectionHandler()
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 monitorid - 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 © 2006-2011 Rio Project. All Rights Reserved.