Interface ClusterDbPoller

All Known Implementing Classes:
ClusterNode

public interface ClusterDbPoller
Interface for polling a cluster node via DB and requesting a restart of the local cluster node if required.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    pollServerDb(long timeout, ClusterInteractionRequest request)
    Polls the server of this cluster and sends an alive signal to the cluster DB service.
    void
    Signals a restart of this cluster node.
  • Method Details

    • pollServerDb

      boolean pollServerDb(long timeout, ClusterInteractionRequest request) throws InterruptedException, TimeoutException, SQLException
      Polls 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 is null, 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, an InterruptedException will be thrown.
      TimeoutException - If the table for updating the status cannot be locked in time, a TimeoutException will be thrown.
      SQLException - If there are problems updating the status in the cluster table, an SQLException will 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.