Interface ClusterDbPoller
-
- All Known Implementing Classes:
ClusterNode
public interface ClusterDbPollerInterface for polling a cluster node via DB and requesting a restart of the local cluster node if required.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanpollServerDb(long timeout, ClusterInteractionRequest request)Polls the server of this cluster and sends an alive signal to the cluster DB service.voidrestartInternal()Signals a restart of this cluster node.
-
-
-
Method Detail
-
pollServerDb
boolean pollServerDb(long timeout, ClusterInteractionRequest request) throws InterruptedException, TimeoutException, SQLExceptionPolls the server of this cluster and sends an alive signal to the cluster DB service. If the server is no longer available or it changed, a restart should be executed. This is indicated by the return value.If the control of the cluster node cannot be acquired in the designated time, this method will do nothing.
- Parameters:
timeout- The time in milliseconds to wait for the cluster control lock.request- Whether to simply poll or to restart the server. A restart request contains the cluster name, the node name as well as the time since when the server has been running. If this isnull, the current server will just be polled.- Returns:
- Whether the cluster node needs to restart since another server has been elected or is about to be elected.
- Throws:
InterruptedException- If the calling thread is interrupted while waiting for the node control or has been interrupted before, anInterruptedExceptionwill be thrown.TimeoutException- If the table for updating the status cannot be locked in time, aTimeoutExceptionwill be thrown.SQLException- If there are problems updating the status in the cluster table, anSQLExceptionwill be thrown.
-
restartInternal
void restartInternal()
Signals a restart of this cluster node. This may be for instance due to the cluster requiring a new server (pollServerDb(long, ClusterInteractionRequest)) or polling fails too often.
-
-