Package com.nimbusds.common.infinispan
Class CacheWorkArounds<K,V>
java.lang.Object
com.nimbusds.common.infinispan.CacheWorkArounds<K,V>
Infinispan cache workarounds.
- Fix around invalidation bug, to force cache load before putIfAbsent, replace, delete operations. See tracking Connect2id server issue https://bitbucket.org/connect2id/server/issues/239/race-condition-in-cacheremove-in
- Enforcing zero cache size for "stateless mode" to enable Infinispan to be run in local mode with no in-memory store, using the configured stores instead.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionCacheWorkArounds
(org.infinispan.Cache<K, V> infinispanCache) Creates a new cache workarounds instance.CacheWorkArounds
(org.infinispan.Cache<K, V> infinispanCache, org.apache.logging.log4j.Logger log) Creates a new cache workarounds instance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
If the cache is in the special "stateless mode" causes the underlying data container (in memory) to be cleared.static boolean
detectInvalidationMode
(org.infinispan.Cache<?, ?> cache) Checks if the specified cache is configured in invalidation mode.static boolean
detectStatelessMode
(org.infinispan.Cache<?, ?> cache) Checks if the specified cache is configured in "stateless mode".getMode()
Returns the special workaround mode.boolean
Returnstrue
if the cache is in invalidation mode.boolean
Returnstrue
if the cache is in the special "stateless mode".
-
Constructor Details
-
CacheWorkArounds
Creates a new cache workarounds instance.- Parameters:
infinispanCache
- The Infinispan cache.
-
CacheWorkArounds
public CacheWorkArounds(org.infinispan.Cache<K, V> infinispanCache, org.apache.logging.log4j.Logger log) Creates a new cache workarounds instance.- Parameters:
infinispanCache
- The Infinispan cache.log
- Optional logger for the detection,null
if not specified.
-
-
Method Details
-
detectInvalidationMode
Checks if the specified cache is configured in invalidation mode.- Parameters:
cache
- The cache to check.- Returns:
true
if the cache is configured in invalidation mode, elsefalse
.
-
detectStatelessMode
Checks if the specified cache is configured in "stateless mode".- Parameters:
cache
- The cache to check.- Returns:
true
if the cache is configured in "stateless mode", elsefalse
.
-
getMode
Returns the special workaround mode.- Returns:
- The workaround mode,
null
if none (implies follow regular operation).
-
isInvalidation
Returnstrue
if the cache is in invalidation mode.- Returns:
true
if the cache is in invalidation mode, elsefalse
.
-
isStateless
Returnstrue
if the cache is in the special "stateless mode".- Returns:
true
if the cache is in the "stateless mode", elsefalse
.
-
clearCacheIfStateless
If the cache is in the special "stateless mode" causes the underlying data container (in memory) to be cleared. Should be called before get, replace, putIfAbsent, remove and iteration operations.
-