public class InfinispanClusterProvider extends Object implements ClusterProvider
ClusterProvider.DCNotify
Modifier and Type | Field and Description |
---|---|
static String |
CLUSTER_STARTUP_TIME_KEY |
protected static org.jboss.logging.Logger |
logger |
Constructor and Description |
---|
InfinispanClusterProvider(int clusterStartupTime,
String myAddress,
org.keycloak.cluster.infinispan.CrossDCAwareCacheFactory crossDCAwareCacheFactory,
InfinispanNotificationsManager notificationsManager,
ExecutorService localExecutor) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
<T> ExecutionResult<T> |
executeIfNotExecuted(String taskKey,
int taskTimeoutInSeconds,
Callable<T> task)
Execute given task just if it's not already in progress (either on this or any other cluster node).
|
Future<Boolean> |
executeIfNotExecutedAsync(String taskKey,
int taskTimeoutInSeconds,
Callable task)
Execute given task just if it's not already in progress (either on this or any other cluster node).
|
int |
getClusterStartupTime()
Same value for all cluster nodes.
|
void |
notify(String taskKey,
ClusterEvent event,
boolean ignoreSender,
ClusterProvider.DCNotify dcNotify)
Notify registered listeners on all cluster nodes in all datacenters.
|
void |
registerListener(String taskKey,
ClusterListener task)
Register task (listener) under given key.
|
protected static final org.jboss.logging.Logger logger
public static final String CLUSTER_STARTUP_TIME_KEY
public InfinispanClusterProvider(int clusterStartupTime, String myAddress, org.keycloak.cluster.infinispan.CrossDCAwareCacheFactory crossDCAwareCacheFactory, InfinispanNotificationsManager notificationsManager, ExecutorService localExecutor)
public int getClusterStartupTime()
ClusterProvider
getClusterStartupTime
in interface ClusterProvider
public <T> ExecutionResult<T> executeIfNotExecuted(String taskKey, int taskTimeoutInSeconds, Callable<T> task)
ClusterProvider
executeIfNotExecuted
in interface ClusterProvider
taskTimeoutInSeconds
- timeout for given task. If there is existing task in progress for longer time, it's considered outdated so we will start our task.public Future<Boolean> executeIfNotExecutedAsync(String taskKey, int taskTimeoutInSeconds, Callable task)
ClusterProvider
executeIfNotExecutedAsync
in interface ClusterProvider
taskTimeoutInSeconds
- timeout for given task. If there is existing task in progress for longer time, it's considered outdated so we will start our task.public void registerListener(String taskKey, ClusterListener task)
ClusterProvider
registerListener
in interface ClusterProvider
public void notify(String taskKey, ClusterEvent event, boolean ignoreSender, ClusterProvider.DCNotify dcNotify)
ClusterProvider
notify
in interface ClusterProvider
ignoreSender
- if true, then sender node itself won't receive the notificationdcNotify
- Specify which DCs to notify. See ClusterProvider.DCNotify
enum values for more infoCopyright © 2020 JBoss by Red Hat. All rights reserved.