Class HeartBeatControl
java.lang.Object
de.aristaflow.adept2.core.registry.cluster.HeartBeatControl
This class controls the heartbeats of a cluster node, that is , the heartbeat for the database
and the heartbeat for the communication.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected de.aristaflow.adept2.core.registry.cluster.CommHeartBeatThe daemon thread that polls the cluster server via communication.protected final LockThe lock required to control the cluster node.protected de.aristaflow.adept2.core.registry.cluster.ClusterHeartBeatThe daemon thread that sends the alive signal of this cluster node and regularly polls for the server.protected final LoggerThe logger of the cluster node. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidspawnCommHeartBeat(ClusterCommPoller poller, String clusterNodeName, String logName, long period) Creates a new thread for polling the cluster server via communication.protected voidspawnHeartBeat(ClusterDbPoller poller, String clusterNodeName, String logName, long period) Creates a new thread for sending an alive signal to the cluster as well as polling the cluster server via database.protected voidTerminates the heartbeat using communication in case one exists.protected voidTerminates the heartbeat polling the database in case one exists.protected voidTriggers the communication heartbeat to poll in case one exists.protected voidTriggers the DB heartbeat to poll using the designated request in case one exists.
-
Field Details
-
logger
The logger of the cluster node. ( -
controlLock
The lock required to control the cluster node. This includes control operations like starting, terminating and restarting but also status changes. -
heartBeat
protected volatile de.aristaflow.adept2.core.registry.cluster.ClusterHeartBeat heartBeatThe daemon thread that sends the alive signal of this cluster node and regularly polls for the server. -
commHeartBeat
protected volatile de.aristaflow.adept2.core.registry.cluster.CommHeartBeat commHeartBeatThe daemon thread that polls the cluster server via communication.
-
-
Method Details
-
spawnHeartBeat
protected void spawnHeartBeat(ClusterDbPoller poller, String clusterNodeName, String logName, long period) Creates a new thread for sending an alive signal to the cluster as well as polling the cluster server via database. A heartbeat thread will only be spawned if there is currently no heartbeat thread. Unless the heartbeat thread itself calls this method.- Parameters:
poller- The interface polling a cluster node via DB.clusterNodeName- The name of the cluster node including the cluster name.logName- The name of the cluster node including some state information to use in logs.period- The time in milliseconds, being alive is signalled/the server node is polled.
-
spawnCommHeartBeat
protected void spawnCommHeartBeat(ClusterCommPoller poller, String clusterNodeName, String logName, long period) Creates a new thread for polling the cluster server via communication. A communication heartbeat thread will only be spawned if there is currently no communication heartbeat thread. Unless the communication heartbeat thread itself calls this method.- Parameters:
poller- The interface polling a cluster node via communication.clusterNodeName- The name of the cluster node including the cluster name.logName- The name of the cluster node including some state information to use in logs.period- The time in milliseconds, being alive is signalled/the server node is polled.
-
triggerPoll
Triggers the DB heartbeat to poll using the designated request in case one exists.- Parameters:
cir- The request used for polling the DB.
-
triggerCommPoll
protected void triggerCommPoll()Triggers the communication heartbeat to poll in case one exists. -
terminateHeartBeat
protected void terminateHeartBeat()Terminates the heartbeat polling the database in case one exists. This is required right before the platform terminates since the cluster heartbeat uses the JDBC data source of the active platform. -
terminateCommHeartBeat
protected void terminateCommHeartBeat()Terminates the heartbeat using communication in case one exists. This is required whenshutting downthe injected service. Afterwards the registry will not provide the cluster service of the server any more and the heartbeat cannot poll.
-