Class JdbcPingClusterHealthImpl
- All Implemented Interfaces:
ClusterHealth
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
init
(KEYCLOAK_JDBC_PING2 discovery, Executor executor) void
inject
(org.infinispan.remoting.transport.Transport transport, org.infinispan.util.concurrent.BlockingManager blockingManager) boolean
It checks the cluster health returningtrue
if this node can continue processing requests.boolean
Determine if the cluster health check is supported.void
Triggers a cluster health check.
-
Constructor Details
-
JdbcPingClusterHealthImpl
public JdbcPingClusterHealthImpl()
-
-
Method Details
-
inject
public void inject(org.infinispan.remoting.transport.Transport transport, org.infinispan.util.concurrent.BlockingManager blockingManager) -
init
-
isHealthy
public boolean isHealthy()Description copied from interface:ClusterHealth
It checks the cluster health returningtrue
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 orfalse
if it does not. Deciding the winning partition is at the implementation discretion.- Specified by:
isHealthy
in interfaceClusterHealth
- 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 interfaceClusterHealth
-
isSupported
public boolean isSupported()Description copied from interface:ClusterHealth
Determine if the cluster health check is supported.- Specified by:
isSupported
in interfaceClusterHealth
- Returns:
- false if the current transport setup doesn't provide enough information.
-