Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Project Rio
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jini.rio.resources.client
Class HeartbeatFaultDetectionHandler

    java.lang.Object
      org.jini.rio.resources.client.AbstractFaultDetectionHandler
          org.jini.rio.resources.client.HeartbeatFaultDetectionHandler

All Implemented Interfaces:
  FaultDetectionHandler<ServiceID>

    public class HeartbeatFaultDetectionHandler

extends AbstractFaultDetectionHandler

A HeartbeatFaultDetectionHandler provides support necessary for a FaultDetectionHandler. The HeartbeatFaultDetectionHandler can be used to monitor a services which implement the `org.jini.rio.core.MonitorableService` interface, as well as for services that do not implement this interface. If the service does implement the `org.jini.rio.core.MonitorableService`, the HeartbeatFaultDetectionHandler creates a server socket and listens for notifications from the service of 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.jini.rio.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.jini.rio.resources.client.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.jini.rio.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

Nested Class Summary

Nested classes/interfaces inherited from class org.jini.rio.resources.client.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.jini.rio.resources.client.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` | `terminate()` Terminate the FaultDetectionHandler

Methods inherited from class org.jini.rio.resources.client.AbstractFaultDetectionHandler
`getName, notifyListeners, register, 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()`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Project Rio
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © Project Rio.