K
- V
- @ThreadSafe public class ClusterExpirationManager<K,V> extends ExpirationManagerImpl<K,V>
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.
InternalExpirationManager.ExpirationConsumer<T,U>
Modifier and Type | Field and Description |
---|---|
protected AdvancedCache<K,V> |
cache |
protected ComponentRef<AdvancedCache<K,V>> |
cacheRef |
protected DistributionManager |
distributionManager |
protected RpcManager |
rpcManager |
cacheNotifier, cf, cfRef, componentRegistry, configuration, dataContainer, enabled, executor, expirationTask, expiring, invokerRef, keyPartitioner, persistenceManager, timeService
Constructor and Description |
---|
ClusterExpirationManager() |
Modifier and Type | Method and Description |
---|---|
protected CompletionStage<Boolean> |
checkExpiredMaxIdle(InternalCacheEntry ice,
int segment)
Response is whether the value should be treated as expired.
|
CompletableFuture<Boolean> |
entryExpiredInMemory(InternalCacheEntry<K,V> entry,
long currentTime,
boolean isWrite)
This should be invoked passing in an entry that is now expired.
|
boolean |
entryExpiredInMemoryFromIteration(InternalCacheEntry<K,V> entry,
long currentTime)
This method is very similar to
InternalExpirationManager.entryExpiredInMemory(InternalCacheEntry, long, boolean) except that it does the
bare minimum when an entry expired to guarantee if the entry is valid or not. |
CompletionStage<Void> |
handleInStoreExpirationInternal(K key)
This is to be invoked when a store entry expires.
|
CompletionStage<Void> |
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 |
processExpiration()
Processes the expiration event queue.
|
void |
start() |
addInternalListener, handleInMemoryExpiration, handlePossibleExpiration, isEnabled, removeInternalListener, stop
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
handleInStoreExpiration, handleInStoreExpiration
registerWriteIncoming, unregisterWrite
protected ComponentRef<AdvancedCache<K,V>> cacheRef
protected RpcManager rpcManager
protected DistributionManager distributionManager
protected AdvancedCache<K,V> cache
public void start()
start
in class ExpirationManagerImpl<K,V>
public void processExpiration()
ExpirationManager
processExpiration
in interface ExpirationManager<K,V>
processExpiration
in class ExpirationManagerImpl<K,V>
public CompletableFuture<Boolean> entryExpiredInMemory(InternalCacheEntry<K,V> entry, long currentTime, boolean isWrite)
InternalExpirationManager
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.
entryExpiredInMemory
in interface InternalExpirationManager<K,V>
entryExpiredInMemory
in class ExpirationManagerImpl<K,V>
entry
- the entry that has expiredcurrentTime
- the current time when it expiredisWrite
- if the expiration was found during a write operationpublic boolean entryExpiredInMemoryFromIteration(InternalCacheEntry<K,V> entry, long currentTime)
InternalExpirationManager
InternalExpirationManager.entryExpiredInMemory(InternalCacheEntry, long, boolean)
except that it does the
bare minimum when an entry expired to guarantee if the entry is valid or not. This is important to reduce time
spent per entry when iterating. This method may not actually remove the entry and may just return immediately
if it is safe to do so.entryExpiredInMemoryFromIteration
in interface InternalExpirationManager<K,V>
entryExpiredInMemoryFromIteration
in class ExpirationManagerImpl<K,V>
entry
- the entry that has expiredcurrentTime
- the current time when it expiredpublic CompletionStage<Void> handleInStoreExpirationInternal(K key)
InternalExpirationManager
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.
handleInStoreExpirationInternal
in interface InternalExpirationManager<K,V>
handleInStoreExpirationInternal
in class ExpirationManagerImpl<K,V>
key
- the key of the expired entry
This method will be renamed to handleInStoreExpiration when the method can be removed from ExpirationManager
public CompletionStage<Void> handleInStoreExpirationInternal(MarshallableEntry<K,V> marshalledEntry)
InternalExpirationManager
ExpirationManager.handleInStoreExpiration(Object)
as it allows for more
specific expiration to possibly occur.handleInStoreExpirationInternal
in interface InternalExpirationManager<K,V>
handleInStoreExpirationInternal
in class ExpirationManagerImpl<K,V>
marshalledEntry
- the entry that can be unmarshalled as needed
This method will be renamed to handleInStoreExpiration when the method can be removed from ExpirationManager
protected CompletionStage<Boolean> checkExpiredMaxIdle(InternalCacheEntry ice, int segment)
ExpirationManagerImpl
checkExpiredMaxIdle
in class ExpirationManagerImpl<K,V>
ice
- the entry to check expiration and touchsegment
- the segment the entry maps toCopyright © 2021 JBoss by Red Hat. All rights reserved.