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, setPrePassivated
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
getLastUsed, isInUse, isPrePassivated, setInUse, setPrePassivated
compareTo
public NonPassivatingBackingCacheEntry(V wrapped)
wrapped
- the item to wrappublic V getUnderlyingItem()
BackingCacheEntry
getUnderlyingItem
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()
BackingCacheEntry
RuntimeException
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()
BackingCacheEntry
tryLock
in interface BackingCacheEntry<K extends Serializable,V extends Cacheable<K>>
true
if the lock was acquired, false
otherwisepublic void unlock()
BackingCacheEntry
unlock
in interface BackingCacheEntry<K extends Serializable,V extends Cacheable<K>>
public void invalidate()
BackingCacheEntry
BackingCacheEntry.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()
BackingCacheEntry
NOTE: 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>>
true
e if still valid, false
e if invalidatedBackingCacheEntry.invalidate()
Copyright © 2013 JBoss, a division of Red Hat, Inc.. All rights reserved.