@ThreadSafe public class ExpirationManagerImpl<K,V> extends Object implements ExpirationManager<K,V>
Modifier and Type | Field and Description |
---|---|
protected String |
cacheName |
protected CacheNotifier<K,V> |
cacheNotifier |
protected Configuration |
configuration |
protected DataContainer<K,V> |
dataContainer |
protected boolean |
enabled |
protected ScheduledExecutorService |
executor |
protected ScheduledFuture<?> |
expirationTask |
protected ConcurrentMap<K,Object> |
expiring
This map is used for performance reasons.
|
protected static Log |
log |
protected PersistenceManager |
persistenceManager |
protected TimeService |
timeService |
protected static boolean |
trace |
Constructor and Description |
---|
ExpirationManagerImpl() |
Modifier and Type | Method and Description |
---|---|
void |
handleInMemoryExpiration(InternalCacheEntry<K,V> entry,
long currentTime)
This should be invoked passing in an entry that is now expired.
|
void |
handleInStoreExpiration(K key)
This is to be invoked when a store entry expires.
|
void |
handleInStoreExpiration(MarshalledEntry<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 |
initialize(ScheduledExecutorService executor,
Cache<K,V> cache,
Configuration cfg,
DataContainer<K,V> dataContainer,
PersistenceManager persistenceManager,
CacheNotifier<K,V> cacheNotifier,
TimeService timeService) |
boolean |
isEnabled() |
void |
processExpiration()
Processes the expiration event queue.
|
void |
registerWriteIncoming(K key)
This is to be invoked with a when a write is known to occur to prevent expiration from happening.
|
void |
start() |
void |
stop() |
void |
unregisterWrite(K key)
This should always be invoked after registering write but after performing any operations required.
|
protected static final Log log
protected static final boolean trace
protected ScheduledFuture<?> expirationTask
protected ScheduledExecutorService executor
protected Configuration configuration
protected PersistenceManager persistenceManager
protected DataContainer<K,V> dataContainer
protected CacheNotifier<K,V> cacheNotifier
protected TimeService timeService
protected boolean enabled
protected String cacheName
protected ConcurrentMap<K,Object> expiring
public void initialize(ScheduledExecutorService executor, Cache<K,V> cache, Configuration cfg, DataContainer<K,V> dataContainer, PersistenceManager persistenceManager, CacheNotifier<K,V> cacheNotifier, TimeService timeService)
public void start()
public void processExpiration()
ExpirationManager
processExpiration
in interface ExpirationManager<K,V>
public boolean isEnabled()
isEnabled
in interface ExpirationManager<K,V>
public void handleInMemoryExpiration(InternalCacheEntry<K,V> entry, long currentTime)
ExpirationManager
handleInMemoryExpiration
in interface ExpirationManager<K,V>
entry
- entry that is now expiredcurrentTime
- the current time in millisecondspublic void handleInStoreExpiration(K key)
ExpirationManager
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.
handleInStoreExpiration
in interface ExpirationManager<K,V>
key
- the key of the expired entrypublic void handleInStoreExpiration(MarshalledEntry<K,V> marshalledEntry)
ExpirationManager
ExpirationManager.handleInStoreExpiration(Object)
as it allows for more
specific expiration to possibly occur.handleInStoreExpiration
in interface ExpirationManager<K,V>
marshalledEntry
- the entry that can be unmarshalled as neededpublic void registerWriteIncoming(K key)
ExpirationManager
registerWriteIncoming
in interface ExpirationManager<K,V>
key
- the key to usepublic void unregisterWrite(K key)
ExpirationManager
unregisterWrite
in interface ExpirationManager<K,V>
key
- the key to usepublic void stop()
Copyright © 2024 JBoss, a division of Red Hat. All rights reserved.