Rio Project 4.2 API Documentation



org.rioproject.fdh
Class AbstractFaultDetectionHandler

java.lang.Object
  extended by org.rioproject.fdh.AbstractFaultDetectionHandler
All Implemented Interfaces:
FaultDetectionHandler<ServiceID>
Direct Known Subclasses:
AdminFaultDetectionHandler, HeartbeatFaultDetectionHandler, JMXFaultDetectionHandler, LeaseFaultDetectionHandler

public abstract class AbstractFaultDetectionHandler
extends Object
implements FaultDetectionHandler<ServiceID>

The AbstractFaultDetectionHandler provides a base class which can be extended to provide concrete FaultDetectionHandler capabilities. The basic infrastructure included in the AbstractFaultDetectionHandler includes FaultDetectionListener registration and notification, a ServiceDiscoveryListener implementation Properties that will be common across all classes which extend this class are also provided:

Author:
Dennis Reedy
See Also:
FaultDetectionHandler, FaultDetectionListener

Nested Class Summary
static interface AbstractFaultDetectionHandler.ServiceMonitor
          Defines the semantics of an internal class which will be used in perform service-specific monitoring
 
Field Summary
protected  Configuration config
          A Configuration object
protected  String[] configArgs
          Configuration arguments
static int DEFAULT_RETRY_COUNT
           
static long DEFAULT_RETRY_TIMEOUT
           
protected  Object proxy
          Object that can be used to communicate to the service
static String RETRY_COUNT_KEY
           
static String RETRY_TIMEOUT_KEY
           
protected  int retryCount
           
protected  long retryTimeout
           
protected  AbstractFaultDetectionHandler.ServiceMonitor serviceMonitor
          Class which provides service monitoring
protected  boolean terminating
          Flag to indicate the utility is terminating
 
Constructor Summary
AbstractFaultDetectionHandler()
           
 
Method Summary
protected  String getName(Entry[] attrs)
          Get the first Name.name from the attribute collection set
protected abstract  AbstractFaultDetectionHandler.ServiceMonitor getServiceMonitor()
          Get the class which implements the ServiceMonitor
 void monitor(Object proxy, ServiceID id, LookupCache lCache)
          Begin monitoring the service
protected  void notifyListeners()
          Notify FaultDetectionListener instances the service has been removed
 void register(FaultDetectionListener<ServiceID> listener)
          Register a FaultDetectionListener
 void setRetryCount(int retryCount)
           
 void setRetryTimeout(long retryTimeout)
           
 void terminate()
          Terminate the FaultDetectionHandler
 void unregister(FaultDetectionListener<ServiceID> listener)
          Unregister a FaultDetectionListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.rioproject.fdh.FaultDetectionHandler
setConfiguration
 

Field Detail

DEFAULT_RETRY_COUNT

public static final int DEFAULT_RETRY_COUNT
See Also:
Constant Field Values

DEFAULT_RETRY_TIMEOUT

public static final long DEFAULT_RETRY_TIMEOUT
See Also:
Constant Field Values

RETRY_COUNT_KEY

public static final String RETRY_COUNT_KEY
See Also:
Constant Field Values

RETRY_TIMEOUT_KEY

public static final String RETRY_TIMEOUT_KEY
See Also:
Constant Field Values

proxy

protected Object proxy
Object that can be used to communicate to the service


retryCount

protected int retryCount

retryTimeout

protected long retryTimeout

terminating

protected boolean terminating
Flag to indicate the utility is terminating


configArgs

protected String[] configArgs
Configuration arguments


config

protected Configuration config
A Configuration object


serviceMonitor

protected AbstractFaultDetectionHandler.ServiceMonitor serviceMonitor
Class which provides service monitoring

Constructor Detail

AbstractFaultDetectionHandler

public AbstractFaultDetectionHandler()
Method Detail

register

public void register(FaultDetectionListener<ServiceID> listener)
Description copied from interface: FaultDetectionHandler
Register a FaultDetectionListener

Specified by:
register in interface FaultDetectionHandler<ServiceID>
Parameters:
listener - The FaultDetectionListener to register
See Also:
FaultDetectionHandler.register(org.rioproject.fdh.FaultDetectionListener)

unregister

public void unregister(FaultDetectionListener<ServiceID> listener)
Description copied from interface: FaultDetectionHandler
Unregister a FaultDetectionListener

Specified by:
unregister in interface FaultDetectionHandler<ServiceID>
Parameters:
listener - The FaultDetectionListener to unregister
See Also:
FaultDetectionHandler.unregister(org.rioproject.fdh.FaultDetectionListener)

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>
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 abstract AbstractFaultDetectionHandler.ServiceMonitor getServiceMonitor()
                                                                           throws Exception
Get the class which implements the ServiceMonitor

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>
See Also:
FaultDetectionHandler.terminate()

notifyListeners

protected void notifyListeners()
Notify FaultDetectionListener instances the service has been removed


setRetryCount

public void setRetryCount(int retryCount)

setRetryTimeout

public void setRetryTimeout(long retryTimeout)

getName

protected String getName(Entry[] attrs)
Get the first Name.name from the attribute collection set

Parameters:
attrs - Array of Entry objects
Returns:
The the first Name.name from the attribute collection set or null if not found

Copyright © Rio Project.

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