public class NonPassivatingBackingCacheEntry<K extends Serializable,V extends Cacheable<K>> extends AbstractBackingCacheEntry<K,V> implements BackingCacheEntry<K,V>
BasicCacheEntry implementation for use with a non-passivating BackingCache. A wrapper for the
Cacheable to allow it to be managed by the backing cache .| Constructor and Description |
|---|
NonPassivatingBackingCacheEntry(V wrapped)
Create a new SimpleBackingCacheEntry.
|
| Modifier and Type | Method and Description |
|---|---|
K |
getId()
The object identifier.
|
V |
getUnderlyingItem()
Gets the underlying CacheItem.
|
void |
invalidate()
Causes
BackingCacheEntry.isValid() to hereafter return true. |
boolean |
isModified()
Gets whether this object's internal state has been modified since
the last request to this method.
|
boolean |
isValid()
Whether this entry has been invalidated (in which case it should be reacquired).
|
void |
lock()
Lock this item, blocking until the lock is acquired.
|
boolean |
tryLock()
Attempt to lock this item, failing promptly if the lock is already held by another thread.
|
void |
unlock()
Unlock this item.
|
compareTo, equals, getLastUsed, hashCode, isInUse, isPrePassivated, setInUse, setLastUsed, setPrePassivatedclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitgetLastUsed, isInUse, isPrePassivated, setInUse, setPrePassivatedcompareTopublic NonPassivatingBackingCacheEntry(V wrapped)
wrapped - the item to wrappublic V getUnderlyingItem()
BackingCacheEntrygetUnderlyingItem in interface BackingCacheEntry<K extends Serializable,V extends Cacheable<K>>public boolean isModified()
Cacheable
Implementations must be aggressive about returning true if
they are uncertain about whether they have been modified; false
should only be returned if the implementing object is certain its
internal state has not been modified.
isModified in interface Cacheable<K extends Serializable>true if the state has been modified or the
implementing object does not know; false otherwise.public K getId()
getId in interface Identifiable<K extends Serializable>underlying item. Cannot be null.public void lock()
BackingCacheEntryRuntimeException will be thrown if the thread is interrupted instead of
InterruptedException.lock in interface BackingCacheEntry<K extends Serializable,V extends Cacheable<K>>public boolean tryLock()
BackingCacheEntrytryLock in interface BackingCacheEntry<K extends Serializable,V extends Cacheable<K>>true if the lock was acquired, false otherwisepublic void unlock()
BackingCacheEntryunlock in interface BackingCacheEntry<K extends Serializable,V extends Cacheable<K>>public void invalidate()
BackingCacheEntryBackingCacheEntry.isValid() to hereafter return true.
NOTE: This method should only be called with the lock held.
invalidate in interface BackingCacheEntry<K extends Serializable,V extends Cacheable<K>>invalidate in class AbstractBackingCacheEntry<K extends Serializable,V extends Cacheable<K>>public boolean isValid()
BackingCacheEntryNOTE: This method should only be called with the lock held.
isValid in interface BackingCacheEntry<K extends Serializable,V extends Cacheable<K>>isValid in class AbstractBackingCacheEntry<K extends Serializable,V extends Cacheable<K>>truee if still valid, falsee if invalidatedBackingCacheEntry.invalidate()Copyright © 2013 JBoss, a division of Red Hat, Inc.. All Rights Reserved.