Class InfinispanUtil
java.lang.Object
org.keycloak.connections.infinispan.InfinispanUtil
- Author:
- Marek Posolda
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.infinispan.commons.time.TimeServiceprotected static final org.jboss.logging.Loggerstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidconfigureTransport(org.infinispan.configuration.global.GlobalConfigurationBuilder gcb, String nodeName, String siteName, String jgroupsUdpMcastAddr, String jgroupsConfigPath) static org.infinispan.configuration.cache.ConfigurationBuilderstatic org.infinispan.configuration.cache.ConfigurationBuilderstatic org.infinispan.client.hotrod.RemoteCachegetRemoteCache(org.infinispan.Cache ispnCache) static Set<org.infinispan.persistence.remote.RemoteStore>getRemoteStores(org.infinispan.Cache ispnCache) static TopologyInfogetTopologyInfo(KeycloakSession session) static booleanisCoordinator(org.infinispan.Cache cache) static RunnablesetTimeServiceToKeycloakTime(org.infinispan.manager.EmbeddedCacheManager cacheManager) Replaces theTimeServicein infinispan with the one that respects KeycloakTime.static longtoHotrodTimeMs(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 theTimeServicein infinispan with the one that respects KeycloakTime.- Parameters:
cacheManager-- Returns:
- Runnable to revert replacement of the infinispan time service
-