org.keycloak.cluster

## Interface ClusterProvider

- All Superinterfaces:
    Provider
  All Known Implementing Classes:
    InfinispanClusterProvider

      public interface ClusterProvider
      extends Provider

  Various utils related to clustering and concurrent tasks on cluster nodes
  Author:
    Marek Posolda

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `<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).
    `int` | `getClusterStartupTime()` Same value for all cluster nodes.
    `void` | `notify(String taskKey, ClusterEvent event)` Notify registered listeners on all cluster nodes
    `void` | `registerListener(String taskKey, ClusterListener task)` Register task (listener) under given key.

    - ### Methods inherited from interface org.keycloak.provider.Provider

      `close`

- - ### Method Detail

    - #### getClusterStartupTime

          int getClusterStartupTime()

      Same value for all cluster nodes. It will use startup time of this server in non-cluster environment.

    - #### executeIfNotExecuted

          <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).
      Type Parameters:
        `T` -
      Parameters:
        `taskKey` -
        `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.
        `task` -
      Returns:
        result with "executed" flag specifying if execution was executed or ignored.

    - #### registerListener

          void registerListener(String taskKey,
                                ClusterListener task)

      Register task (listener) under given key. When this key will be put to the cache on any cluster node, the task will be executed
      Parameters:
        `taskKey` -
        `task` -

    - #### notify

          void notify(String taskKey,
                      ClusterEvent event)

      Notify registered listeners on all cluster nodes
      Parameters:
        `taskKey` -
        `event` -

Copyright © 2016 JBoss by Red Hat. All rights reserved.