Class InfinispanUtil

java.lang.Object
org.keycloak.connections.infinispan.InfinispanUtil

public class InfinispanUtil extends Object
Author:
Marek Posolda
  • Field Details

    • logger

      protected static final org.jboss.logging.Logger logger
    • MAXIMUM_REPLACE_RETRIES

      public static final int MAXIMUM_REPLACE_RETRIES
      See Also:
    • KEYCLOAK_TIME_SERVICE

      public static final org.infinispan.commons.time.TimeService KEYCLOAK_TIME_SERVICE
  • Constructor Details

    • InfinispanUtil

      public InfinispanUtil()
  • Method Details

    • getRemoteStores

      public static Set<org.infinispan.persistence.remote.RemoteStore> getRemoteStores(org.infinispan.Cache ispnCache)
    • getRemoteCache

      public static org.infinispan.client.hotrod.RemoteCache getRemoteCache(org.infinispan.Cache ispnCache)
    • getTopologyInfo

      public static TopologyInfo getTopologyInfo(KeycloakSession session)
    • isCoordinator

      public static boolean isCoordinator(org.infinispan.Cache cache)
      Parameters:
      cache -
      Returns:
      true if cluster coordinator OR if it's local cache
    • toHotrodTimeMs

      public static long toHotrodTimeMs(org.infinispan.commons.api.BasicCache ispnCache, long lifespanOrigMs)
      Convert the given value to the proper value, which can be used when calling operations for the infinispan remoteCache. Infinispan HotRod protocol of versions older than 3.0 uses the "lifespan" or "maxIdle" as the normal expiration time when the value is 30 days or less. However for the bigger values, it assumes that the value is unix timestamp.
      Parameters:
      ispnCache -
      lifespanOrigMs -
      Returns:
    • configureTransport

      public static void configureTransport(org.infinispan.configuration.global.GlobalConfigurationBuilder gcb, String nodeName, String siteName, String jgroupsUdpMcastAddr, String jgroupsConfigPath)
    • createCacheConfigurationBuilder

      public static org.infinispan.configuration.cache.ConfigurationBuilder createCacheConfigurationBuilder()
    • getActionTokenCacheConfig

      public static org.infinispan.configuration.cache.ConfigurationBuilder getActionTokenCacheConfig()
    • setTimeServiceToKeycloakTime

      public static Runnable setTimeServiceToKeycloakTime(org.infinispan.manager.EmbeddedCacheManager cacheManager)
      Replaces the TimeService in infinispan with the one that respects Keycloak Time.
      Parameters:
      cacheManager -
      Returns:
      Runnable to revert replacement of the infinispan time service