Class ClusterExpirationManager<K,V>
- Type Parameters:
K
-V
-
- All Implemented Interfaces:
ExpirationManager<K,
,V> InternalExpirationManager<K,
V>
- Direct Known Subclasses:
TxClusterExpirationManager
Cache stores however do not supply the value or metadata information which means if an entry is purged from the cache store that it will forcibly remove the value even if a concurrent write updated it just before. This will be addressed by future SPI changes to the cache store.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.infinispan.expiration.impl.InternalExpirationManager
InternalExpirationManager.ExpirationConsumer<T,
U> -
Field Summary
Fields inherited from class org.infinispan.expiration.impl.ExpirationManagerImpl
cache, cacheName, cacheNotifier, cacheRef, configuration, dataContainer, enabled, executor, expirationTask, expiring, keyPartitioner, persistenceManager, timeService
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected CompletionStage
<Boolean> checkExpiredMaxIdle
(InternalCacheEntry<?, ?> ice, int segment, long currentTime) Response is whether the value should be treated as expired.entryExpiredInMemory
(InternalCacheEntry<K, V> entry, long currentTime, boolean isWrite) This should be invoked passing in an entry that is now expired.This is to be invoked when a store entry expires.handleInStoreExpirationInternal
(MarshallableEntry<K, V> marshalledEntry) This is to be invoked when a store entry expires and the value and/or metadata is available to be used.void
Processes the expiration event queue.void
start()
Methods inherited from class org.infinispan.expiration.impl.ExpirationManagerImpl
addInternalListener, handlePossibleExpiration, isEnabled, removeInternalListener, stop
-
Field Details
-
rpcManager
-
distributionManager
-
-
Constructor Details
-
ClusterExpirationManager
public ClusterExpirationManager()
-
-
Method Details
-
start
public void start()- Overrides:
start
in classExpirationManagerImpl<K,
V>
-
processExpiration
public void processExpiration()Description copied from interface:ExpirationManager
Processes the expiration event queue.- Specified by:
processExpiration
in interfaceExpirationManager<K,
V> - Overrides:
processExpiration
in classExpirationManagerImpl<K,
V>
-
entryExpiredInMemory
public CompletableFuture<Boolean> entryExpiredInMemory(InternalCacheEntry<K, V> entry, long currentTime, boolean isWrite) Description copied from interface:InternalExpirationManager
This should be invoked passing in an entry that is now expired. This method may attempt to lock this key to preserve atomicity. This method should be invoked when an entry was read via get but found to be expired.This method returns true if the entry was removed due to expiration or false if the entry was not removed due to expiration
If hasLock is true, this method assumes that the caller has the lock for the key and it must allow the expiration to occur, ie. returned CompletableFuture has completed, before the lock is released. Failure to do so may cause inconsistency in data.
- Specified by:
entryExpiredInMemory
in interfaceInternalExpirationManager<K,
V> - Overrides:
entryExpiredInMemory
in classExpirationManagerImpl<K,
V> - Parameters:
entry
- the entry that has expiredcurrentTime
- the current time when it expiredisWrite
- if the expiration was found during a write operation- Returns:
- if this entry actually expired or not
-
handleInStoreExpirationInternal
Description copied from interface:InternalExpirationManager
This is to be invoked when a store entry expires. This method may attempt to lock this key to preserve atomicity.Note this method doesn't currently take a
InternalCacheEntry
and this is due to a limitation in the cache store API. This may cause some values to be removed if they were updated at the same time.- Specified by:
handleInStoreExpirationInternal
in interfaceInternalExpirationManager<K,
V> - Overrides:
handleInStoreExpirationInternal
in classExpirationManagerImpl<K,
V> - Parameters:
key
- the key of the expired entry This method will be renamed to handleInStoreExpiration when the method can be removed fromExpirationManager
-
handleInStoreExpirationInternal
public CompletionStage<Void> handleInStoreExpirationInternal(MarshallableEntry<K, V> marshalledEntry) Description copied from interface:InternalExpirationManager
This is to be invoked when a store entry expires and the value and/or metadata is available to be used.- Specified by:
handleInStoreExpirationInternal
in interfaceInternalExpirationManager<K,
V> - Overrides:
handleInStoreExpirationInternal
in classExpirationManagerImpl<K,
V> - Parameters:
marshalledEntry
- the entry that can be unmarshalled as needed This method will be renamed to handleInStoreExpiration when the method can be removed fromExpirationManager
-
checkExpiredMaxIdle
protected CompletionStage<Boolean> checkExpiredMaxIdle(InternalCacheEntry<?, ?> ice, int segment, long currentTime) Description copied from class:ExpirationManagerImpl
Response is whether the value should be treated as expired. This is determined by if a value as able to be touched or not, that is if it couldn't be touched - we assumed expired (as it was removed in some way).- Overrides:
checkExpiredMaxIdle
in classExpirationManagerImpl<K,
V> - Parameters:
ice
- the entry to check expiration and touchsegment
- the segment the entry maps tocurrentTime
- the current time in milliseconds- Returns:
- whether the entry was expired or not
-