public class ClusterNodeState
extends java.lang.Object
ClusterNode. Both classes interact closely with respect to field access and locking.| Modifier and Type | Field and Description |
|---|---|
protected AbortServiceException |
aseBlocker
An
AbortServiceException that occurred and blocks the cluster node from
continuing. |
protected java.lang.String |
clusterName
The cluster name of the node.
|
protected java.util.concurrent.locks.Lock |
controlLock
The lock required to control the cluster node.
|
protected java.util.concurrent.locks.Condition |
controlSignal
The condition for the node control to wait for external signals, e. g.
|
protected java.util.Set<java.lang.Thread> |
currentStatusChangeWaiters
The threads that await
statusChange which has been signalled. |
protected java.lang.Error |
errBlocker
An
Error that occurred and blocks the cluster node from continuing. |
protected boolean |
isServer
Whether the cluster node is a server node.
|
protected long |
lastStatusUpdate
The time the status has been updated the last time.
|
protected java.lang.String |
name
The name of the cluster node.
|
protected java.util.Set<java.lang.Thread> |
nextStatusChangeWaiters
The threads that await
statusChange and have arrived after its last signalling. |
protected java.lang.Thread |
nodeControl
The thread controlling the cluster node, that is it handles the complete node lifecycle
including restarting and thus changing roles.
|
protected boolean |
restarting
Whether the control thread has accepted a restarting request and is currently restarting.
|
protected boolean |
restartRequested
Whether a restart has been requested from the outside or becomes necessary due to internal
problems.
|
protected long |
runningSince
The time since the cluster node is running (value stems from the database).
|
protected boolean |
shutdown
Whether a shutdown has been requested from the outside or becomes necessary due to internal
problems.
|
protected Status |
status
The current status of the cluster node.
|
protected java.util.concurrent.locks.Condition |
statusChange
The condition of the control lock for threads that wait for a specific status,
awaitStatus(long, Status...). |
protected java.util.concurrent.locks.Condition |
statusChangeWaitersLeft
The condition of the control lock to let node control wait for all threads currently waiting
for
statusChange. |
| Modifier and Type | Method and Description |
|---|---|
Status |
awaitStatus(long timeout,
Status... statuses)
Waits until the cluster node reaches one of the designated statuses or until the designated
timeout elapsed.
|
java.lang.String |
getClusterName()
Gets the name of the cluster of this node if available.
|
java.lang.String |
getClusterNodeName()
Gets the complete name of this cluster node, that is the name of the cluster (if available) and
the node name.
|
protected java.lang.String |
getLogName()
Gets the name of the cluster together with whether it is a server or client cluster node.
|
java.lang.String |
getName()
Gets the name of the cluster node.
|
Status |
getStatus()
Gets the current status of the cluster node without waiting.
|
protected final java.lang.String name
protected java.lang.String clusterName
protected volatile boolean isServer
protected volatile boolean shutdown
protected volatile boolean restartRequested
protected volatile boolean restarting
protected volatile Status status
protected volatile long lastStatusUpdate
protected volatile long runningSince
protected AbortServiceException aseBlocker
AbortServiceException that occurred and blocks the cluster node from
continuing.protected java.lang.Error errBlocker
Error that occurred and blocks the cluster node from continuing.protected final java.lang.Thread nodeControl
protected final java.util.concurrent.locks.Lock controlLock
protected final java.util.concurrent.locks.Condition controlSignal
restart(long).protected final java.util.concurrent.locks.Condition statusChange
awaitStatus(long, Status...).protected volatile java.util.Set<java.lang.Thread> nextStatusChangeWaiters
statusChange and have arrived after its last signalling.protected volatile java.util.Set<java.lang.Thread> currentStatusChangeWaiters
statusChange which has been signalled. This threads have to
leave (if their condition is right). This prevents threads waiting for
statusChange to miss signals.protected final java.util.concurrent.locks.Condition statusChangeWaitersLeft
statusChange. This is signalled as soon as
currentStatusChangeWaiters is empty.public java.lang.String getName()
ClusterNode.public java.lang.String getClusterName()
null if there is currently
no platform.null if there is no current
platform.public java.lang.String getClusterNodeName()
protected java.lang.String getLogName()
public Status getStatus() throws AbortServiceException
AbortServiceException - If there are non-recoverable problems with the cluster especially
when bootstrapping, an AbortServiceException will be thrown. This
exception indicates that the status is Status.TERMINATED.public Status awaitStatus(long timeout, Status... statuses) throws java.lang.InterruptedException, AbortServiceException
null in case the timeout
elapsed before one of these statuses has been reached. Status.TERMINATED will remain the status
and no waiting will take place.timeout - The time in milliseconds to wait for the cluster node to reach one of the
designated statuses. Use 0 to not wait at all or a negative value to wait without time
limit. The time required for the lock will count to this timeout.statuses - The statuses which should be reached by this cluster node.null otherwise.java.lang.InterruptedException - If the current thread is interrupted while waiting for one of the
designated statuses, an InterruptedException will be thrown.AbortServiceException - If there are non-recoverable problems with the cluster especially
when bootstrapping, an AbortServiceException will be thrown.