Class InfinispanUtil
java.lang.Object
org.keycloak.connections.infinispan.InfinispanUtil
- Author:
- Marek Posolda
-
Field Summary
Modifier and TypeFieldDescriptionstatic final org.infinispan.commons.time.TimeService
protected static final org.jboss.logging.Logger
static final int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
configureTransport
(org.infinispan.configuration.global.GlobalConfigurationBuilder gcb, String nodeName, String siteName, String jgroupsUdpMcastAddr, String jgroupsConfigPath) static org.infinispan.configuration.cache.ConfigurationBuilder
static org.infinispan.configuration.cache.ConfigurationBuilder
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 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
-
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
-
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
-