Class InfinispanUtil
- java.lang.Object
-
- org.keycloak.connections.infinispan.InfinispanUtil
-
public class InfinispanUtil extends Object
- Author:
- Marek Posolda
-
-
Field Summary
Fields Modifier and Type Field Description static org.infinispan.commons.time.TimeService
KEYCLOAK_TIME_SERVICE
protected static org.jboss.logging.Logger
logger
static int
MAXIMUM_REPLACE_RETRIES
-
Constructor Summary
Constructors Constructor Description InfinispanUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
configureTransport(org.infinispan.configuration.global.GlobalConfigurationBuilder gcb, String nodeName, String siteName, String jgroupsUdpMcastAddr, String jgroupsConfigPath)
static org.infinispan.configuration.cache.ConfigurationBuilder
createCacheConfigurationBuilder()
static org.infinispan.configuration.cache.ConfigurationBuilder
getActionTokenCacheConfig()
static org.infinispan.client.hotrod.RemoteCache
getRemoteCache(org.infinispan.Cache ispnCache)
static Set<org.infinispan.persistence.remote.RemoteStore>
getRemoteStores(org.infinispan.Cache ispnCache)
static TopologyInfo
getTopologyInfo(KeycloakSession session)
static boolean
isCoordinator(org.infinispan.Cache cache)
static Runnable
setTimeServiceToKeycloakTime(org.infinispan.manager.EmbeddedCacheManager cacheManager)
Replaces theTimeService
in infinispan with the one that respects KeycloakTime
.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.
-
-
-
Field Detail
-
logger
protected static final org.jboss.logging.Logger logger
-
MAXIMUM_REPLACE_RETRIES
public static final int MAXIMUM_REPLACE_RETRIES
- See Also:
- Constant Field Values
-
KEYCLOAK_TIME_SERVICE
public static final org.infinispan.commons.time.TimeService KEYCLOAK_TIME_SERVICE
-
-
Method Detail
-
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 theTimeService
in infinispan with the one that respects KeycloakTime
.- Parameters:
cacheManager
-- Returns:
- Runnable to revert replacement of the infinispan time service
-
-