|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.sgs.impl.service.watchdog.NodeImpl
class NodeImpl
Implements the Node interface. The state for a given
nodeId is bound in the datastore with the following service
bound name:
com.sun.sgs.impl.service.watchdog.NodeImpl.nodeId
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.sun.sgs.service.Node |
|---|
Node.Health |
| Field Summary | |
|---|---|
static long |
INVALID_ID
The ID for an unknown node. |
| Constructor Summary | |
|---|---|
NodeImpl(long nodeId,
String hostName,
int jmxPort,
WatchdogClient client)
Constructs an instance of this class with the given nodeId, hostName, and client. |
|
NodeImpl(long nodeId,
String hostName,
Node.Health health)
Constructs an instance of this class with the given nodeId, hostName, and health. |
|
NodeImpl(long nodeId,
String hostName,
Node.Health health,
long backupId)
Constructs an instance of this class with the given nodeId, hostName, isAlive status, and
backupId. |
|
| Method Summary | |
|---|---|
(package private) void |
addPrimary(DataService dataService,
long primaryId)
Adds the specified primaryId to the list of primaries
for which this node is a backup, and updates the node's state
in the specified dataService. |
int |
compareTo(NodeImpl o)
|
boolean |
equals(Object obj)
|
(package private) long |
getBackupId()
Returns the backup for this node, or -1L if there is no backup. |
(package private) long |
getExpiration()
Returns the expiration time. |
Node.Health |
getHealth()
Returns the health of the node. |
String |
getHostName()
Returns this node's host name. |
long |
getId()
Returns the node ID, which is always non-negative. |
(package private) static NodeImpl |
getNode(DataService dataService,
long nodeId)
Returns the Node instance for the given nodeId,
retrieved from the specified dataService, or null if the node isn't bound in the data service . |
(package private) static NodeImpl |
getNodeForUpdate(DataService dataService,
long nodeId)
Returns the Node instance for the given nodeId,
retrieved from the specified dataService for update. |
(package private) NodeInfo |
getNodeInfo()
Returns the management information for this node. |
(package private) static Iterator<Node> |
getNodes(DataService dataService)
Returns an iterator for Node instances to be retrieved
from the specified dataService. |
(package private) Set<Long> |
getPrimaries()
Returns the set of primary nodes for which this node is a backup. |
(package private) WatchdogClient |
getWatchdogClient()
Returns the watchdog client, or null. |
(package private) boolean |
hasBackup()
Returns true if this node has a backup. |
int |
hashCode()
|
boolean |
isAlive()
Returns true if the node is known to be alive, and
false if the node is thought to have failed or is
unknown. |
(package private) boolean |
isExpired()
Returns true if the node is expired, and false
otherwise. |
(package private) static Collection<NodeImpl> |
markAllNodesFailed(DataService dataService)
Marks all nodes currently bound in the specified dataService as failed, and returns a collection of those
nodes. |
(package private) void |
putNode(DataService dataService)
Stores this instance in the specified dataService. |
(package private) static void |
removeNode(DataService dataService,
long nodeId)
Removes the node with the specified nodeId and its
binding from the specified dataService. |
(package private) void |
setExpiration(long newExpiration)
Sets the expiration time for this node instance. |
(package private) void |
setFailed(DataService dataService,
NodeImpl backup)
Sets the health of this node instance to RED,
sets this node's backup to the specified backup,
empties the set of primaries for which this node is recovering,
and updates the node's state in the specified dataService. |
(package private) void |
setHealth(DataService dataService,
Node.Health newHealth)
Sets the health of this node instance to a non-RED value. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final long INVALID_ID
| Constructor Detail |
|---|
NodeImpl(long nodeId,
String hostName,
int jmxPort,
WatchdogClient client)
nodeId, hostName, and client.
This instance's alive status is set to true. The expiration
time for this instance should be set as soon as it is known.
nodeId - a node IDhostName - a host namejmxPort - the port JMX is listening on for the node,
or -1client - a watchdog client
NodeImpl(long nodeId,
String hostName,
Node.Health health)
nodeId, hostName, and health. This
instance's watchdog client is set to null and its
backup is unassigned (backup ID is -1).
nodeId - a node IDhostName - a host name, or nullhealth - the node's health
NodeImpl(long nodeId,
String hostName,
Node.Health health,
long backupId)
nodeId, hostName, isAlive status, and
backupId. This instance's watchdog client is set to
null.
nodeId - a node IDhostName - a host name, or nullhealth - the node's healthbackupId - the ID of the node's backup (-1 if no backup
is assigned)| Method Detail |
|---|
public long getId()
getId in interface Nodepublic String getHostName()
getHostName in interface Nodepublic boolean isAlive()
true if the node is known to be alive, and
false if the node is thought to have failed or is
unknown.
isAlive in interface Nodetrue if the node is alive, and false
otherwisepublic Node.Health getHealth()
getHealth in interface Nodepublic int compareTo(NodeImpl o)
compareTo in interface Comparable<NodeImpl>public boolean equals(Object obj)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic String toString()
toString in class ObjectWatchdogClient getWatchdogClient()
null.
long getExpiration()
0 means that
either the value has not been initialized or the value is not
meaningful because the node has failed. If isAlive()
returns false the value returned from this method is
not meaningful.
void setExpiration(long newExpiration)
newExpiration - the new expiration valueboolean isExpired()
true if the node is expired, and false
otherwise.
true if the node is expired, and false
otherwise
void setFailed(DataService dataService,
NodeImpl backup)
RED,
sets this node's backup to the specified backup,
empties the set of primaries for which this node is recovering,
and updates the node's state in the specified dataService. Subsequent calls to isAlive
will return false.
dataService - a data servicebackup - a chosen backup
ObjectNotFoundException - if this node has been removed
TransactionException - if there is a problem with the
current transaction
void setHealth(DataService dataService,
Node.Health newHealth)
setFailed.
dataService - a data servicenewHealth - the new health of this node
ObjectNotFoundException - if this node has been removed
TransactionException - if there is a problem with the
current transaction
void addPrimary(DataService dataService,
long primaryId)
primaryId to the list of primaries
for which this node is a backup, and updates the node's state
in the specified dataService.
dataService - a data serviceprimaryId - the ID of a primary for which this node is a
backup
ObjectNotFoundException - if this node has been removed
TransactionException - if there is a problem with the
current transactionSet<Long> getPrimaries()
boolean hasBackup()
true if this node has a backup.
long getBackupId()
void putNode(DataService dataService)
dataService.
This method should only be called within a transaction.
dataService - a data service
TransactionException - if there is a problem with the
current transactionNodeInfo getNodeInfo()
static void removeNode(DataService dataService,
long nodeId)
nodeId and its
binding from the specified dataService. If the binding
has already been removed from the dataService this
method takes no action. This method should only be called
within a transaction.
dataService - a data servicenodeId - a node ID
TransactionException - if there is a problem with the
current transaction
static NodeImpl getNode(DataService dataService,
long nodeId)
Node instance for the given nodeId,
retrieved from the specified dataService, or null if the node isn't bound in the data service . This
method should only be called within a transaction.
dataService - a data servicenodeId - a node ID
nodeId, or null
TransactionException - if there is a problem with the
current transaction
static NodeImpl getNodeForUpdate(DataService dataService,
long nodeId)
Node instance for the given nodeId,
retrieved from the specified dataService for update.
This method returns null if the node isn't bound in the data
service . This method must only be called within a transaction.
dataService - a data servicenodeId - a node ID
nodeId, or null
TransactionException - if there is a problem with the
current transactionstatic Collection<NodeImpl> markAllNodesFailed(DataService dataService)
dataService as failed, and returns a collection of those
nodes. This method should only be called within a transaction.
dataService - a data service
TransactionException - if there is a problem with the
current transactionstatic Iterator<Node> getNodes(DataService dataService)
Node instances to be retrieved
from the specified dataService. The returned iterator
does not support the remove operation. This method
should only be called within a transaction, and the returned
iterator should only be used within that transaction.
dataService - a data service
TransactionException - if there is a problem with the
current transaction
|
RedDwarf, Version 0.10.1 2010-03-14 10:56:12 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||