Class JdbcPingClusterHealthImpl

java.lang.Object
org.keycloak.infinispan.health.impl.JdbcPingClusterHealthImpl
All Implemented Interfaces:
ClusterHealth

public class JdbcPingClusterHealthImpl extends Object implements ClusterHealth
A ClusterHealth implementation that makes use of KEYCLOAK_JDBC_PING2.

Since each node is registered in the database, it is possible to detect if a partition is happening.

The method KEYCLOAK_JDBC_PING2.healthStatus() contains the algorithm description. If it returns KEYCLOAK_JDBC_PING2.HealthStatus.ERROR, the healthy state does not change and relies on the Quarkus/Agroal readiness health check. But, if KEYCLOAK_JDBC_PING2.HealthStatus.NO_COORDINATOR is returned, the state will be changed to unhealthy. The should be a temporary situation as at least one coordinator must be present in the database table.

See Also:
  • Constructor Details

    • JdbcPingClusterHealthImpl

      public JdbcPingClusterHealthImpl()
  • Method Details

    • inject

      public void inject(org.infinispan.remoting.transport.Transport transport, org.infinispan.util.concurrent.BlockingManager blockingManager)
    • init

      public void init(KEYCLOAK_JDBC_PING2 discovery, Executor executor)
    • isHealthy

      public boolean isHealthy()
      Description copied from interface: ClusterHealth
      It checks the cluster health returning true if this node can continue processing requests.

      If the network and cluster are stable, this method must return true.

      If a network partition is detected, the return value depends on whether this node belongs to the winning partition. It must return true if it belongs to the winning partition or false if it does not. Deciding the winning partition is at the implementation discretion.

      Specified by:
      isHealthy in interface ClusterHealth
      Returns:
      true if the cluster is healthy and this node can continue processing requests, false otherwise.
    • triggerClusterHealthCheck

      public void triggerClusterHealthCheck()
      Description copied from interface: ClusterHealth
      Triggers a cluster health check.

      This method should only trigger the health check logic without blocking or waiting for its outcome.

      Specified by:
      triggerClusterHealthCheck in interface ClusterHealth
    • isSupported

      public boolean isSupported()
      Description copied from interface: ClusterHealth
      Determine if the cluster health check is supported.
      Specified by:
      isSupported in interface ClusterHealth
      Returns:
      false if the current transport setup doesn't provide enough information.