org.keycloak.cluster.infinispan

## Class InfinispanClusterProvider

- java.lang.Object
- - org.keycloak.cluster.infinispan.InfinispanClusterProvider

- All Implemented Interfaces:
    ClusterProvider, Provider

      public class InfinispanClusterProvider
      extends Object
      implements ClusterProvider

  Author:
    Marek Posolda

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `CLUSTER_STARTUP_TIME_KEY`
    `protected static org.jboss.logging.Logger` | `logger`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `InfinispanClusterProvider(InfinispanClusterProviderFactory factory, KeycloakSession session, org.infinispan.Cache<String,Serializable> cache)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    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).
    `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 class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### logger

          protected static final org.jboss.logging.Logger logger

    - #### CLUSTER_STARTUP_TIME_KEY

          public static final String CLUSTER_STARTUP_TIME_KEY

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### InfinispanClusterProvider

          public InfinispanClusterProvider(InfinispanClusterProviderFactory factory,
                                           KeycloakSession session,
                                           org.infinispan.Cache<String,Serializable> cache)

  - ### Method Detail

    - #### getClusterStartupTime

          public int getClusterStartupTime()

      Description copied from interface: `ClusterProvider`
      Same value for all cluster nodes. It will use startup time of this server in non-cluster environment.
      Specified by:
        `getClusterStartupTime` in interface `ClusterProvider`

    - #### close

          public void close()

      Specified by:
        `close` in interface `Provider`

    - #### executeIfNotExecuted

          public <T> ExecutionResult<T> executeIfNotExecuted(String taskKey,
                                                             int taskTimeoutInSeconds,
                                                             Callable<T> task)

      Description copied from interface: `ClusterProvider`
      Execute given task just if it's not already in progress (either on this or any other cluster node).
      Specified by:
        `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.
      Returns:
        result with "executed" flag specifying if execution was executed or ignored.

    - #### registerListener

          public void registerListener(String taskKey,
                                       ClusterListener task)

      Description copied from interface: `ClusterProvider`
      Register task (listener) under given key. When this key will be put to the cache on any cluster node, the task will be executed
      Specified by:
        `registerListener` in interface `ClusterProvider`

    - #### notify

          public void notify(String taskKey,
                             ClusterEvent event)

      Description copied from interface: `ClusterProvider`
      Notify registered listeners on all cluster nodes
      Specified by:
        `notify` in interface `ClusterProvider`

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