com.sun.sgs.impl.service.watchdog
Interface WatchdogServer

All Superinterfaces:
Remote
All Known Implementing Classes:
WatchdogServerImpl

public interface WatchdogServer
extends Remote

A remote interface for contacting the Watchdog server.


Method Summary
 long currentAppTimeMillis()
          Returns the global application time in milliseconds as it is maintained by the central node.
 void recoveredNode(long nodeId, long backupId)
          Notifies this watchdog that the node with the specified nodeId has been recovered by the node with the specified backupId.
 long registerNode(long nodeId, String host, WatchdogClient client, int jmxPort)
          Registers a node with the corresponding nodeId, host, and client, and returns the interval (in milliseconds) that this watchdog must be notified, via the renewNode method, in order for the specified node to be considered alive.
 boolean renewNode(long nodeId)
          Notifies this watchdog that the node with the specified nodeId is alive.
 void setNodeHealth(long nodeId, boolean isLocal, Node.Health health, String component, int maxNumberOfAttempts)
          Notifies the node with the given ID that its health has been set.
 

Method Detail

registerNode

long registerNode(long nodeId,
                  String host,
                  WatchdogClient client,
                  int jmxPort)
                  throws NodeRegistrationFailedException,
                         IOException
Registers a node with the corresponding nodeId, host, and client, and returns the interval (in milliseconds) that this watchdog must be notified, via the renewNode method, in order for the specified node to be considered alive.

If this method throws NodeRegistrationFailedException, the caller should not retry as this indicates a fatal error.

When a node fails or a new node starts, the given client will be notified of these status changes via its nodeStatusChanges method.

Parameters:
nodeId - the node ID of the node
host - a host name
client - a watchdog client
jmxPort - the port JMX is listening on, or -1 if JMX is not enabled for remote listening on the node
Returns:
the renew interval (in milliseconds)
Throws:
IOException - if a communication problem occurs while invoking this method
NodeRegistrationFailedException - if there is a problem registering the node

renewNode

boolean renewNode(long nodeId)
                  throws IOException
Notifies this watchdog that the node with the specified nodeId is alive. This method returns true if this watchdog still considers the node alive, and returns false otherwise. This watchdog considers the node to have failed if a renew request is not received from the node before the assigned interval, returned from registerNode, expires. If this method returns false for a given nodeId, the caller should not retry this method because the node is considered to have failed.

Parameters:
nodeId - a node ID
Returns:
true if the node is considered alive, false otherwise
Throws:
IOException - if a communication problem occurs while invoking this method

recoveredNode

void recoveredNode(long nodeId,
                   long backupId)
                   throws IOException
Notifies this watchdog that the node with the specified nodeId has been recovered by the node with the specified backupId.

Parameters:
nodeId - the recovered node's ID
backupId - the backup node's ID
Throws:
IOException - if a communication problem occurs while invoking this method

setNodeHealth

void setNodeHealth(long nodeId,
                   boolean isLocal,
                   Node.Health health,
                   String component,
                   int maxNumberOfAttempts)
                   throws IOException
Notifies the node with the given ID that its health has been set. If the health is RED it indicates that the node has failed and should be shutdown. In this case, if the given node is a remote node, this notification is a result of a server running into difficulty communicating with a remote node, so the server's watchdog service is responsible for notifying the watchdog service in order to issue the shutdown. The component parameter may be any identifying string, but is typically the class name of the component that reported the specified health.

Parameters:
nodeId - the node's ID
isLocal - specifies if the node is reporting health on itself or a remote node
health - the node's health
component - the component reported the specified health
maxNumberOfAttempts - the maximum number of attempts to try and resolve an IOException
Throws:
IOException - if a communication error occurs while trying to set the node's health

currentAppTimeMillis

long currentAppTimeMillis()
                          throws IOException
Returns the global application time in milliseconds as it is maintained by the central node. This method returns the amount of time in milliseconds that the current application has been running since the initialize method was called on the application's AppListener object.

Note: Since this method is typically called as part of a Remote interface, appropriate measures should be taken to account for possible network latency.

Returns:
the global application time in milliseconds according to the central time server
Throws:
IOException - if a communication error occurs while invoking this method

RedDwarf, Version 0.10.1
2010-03-14 10:56:12

Copyright © 2010 The RedDwarf Authors. All rights reserved
Copyright © 2007-2010 Sun Microsystems, Inc. All rights reserved