public class DeltaAwareCacheEntry extends Object implements CacheEntry, StateChangingEntry
| Modifier and Type | Class and Description |
|---|---|
protected static class |
DeltaAwareCacheEntry.Flags |
| Modifier and Type | Field and Description |
|---|---|
protected List<Delta> |
deltas |
protected byte |
flags |
protected Object |
key |
protected DeltaAware |
oldValue |
protected AtomicHashMap<?,?> |
uncommittedChanges |
protected DeltaAware |
value |
protected CacheEntry |
wrappedEntry |
| Constructor and Description |
|---|
DeltaAwareCacheEntry(Object key,
DeltaAware value,
CacheEntry wrappedEntry) |
| Modifier and Type | Method and Description |
|---|---|
void |
appendDelta(Delta d) |
void |
commit(DataContainer container,
Metadata metadata)
Commits changes
|
void |
copyStateFlagsFrom(StateChangingEntry other) |
Object |
getKey()
Retrieves the key to this entry
|
long |
getLifespan() |
long |
getMaxIdle() |
Metadata |
getMetadata()
Get metadata of this cache entry.
|
byte |
getStateFlags() |
AtomicHashMap<?,?> |
getUncommittedChages() |
Object |
getValue()
Retrieves the value of this entry
|
boolean |
isChanged() |
boolean |
isCreated() |
boolean |
isEvicted() |
protected boolean |
isFlagSet(DeltaAwareCacheEntry.Flags flag)
Tests whether a flag is set.
|
boolean |
isLoaded() |
boolean |
isNull()
Tests whether the entry represents a null value, typically used for repeatable read.
|
boolean |
isRemoved() |
boolean |
isValid() |
void |
rollback()
Rolls back changes
|
void |
setChanged(boolean changed) |
void |
setCreated(boolean created) |
void |
setEvicted(boolean evicted) |
protected void |
setFlag(DeltaAwareCacheEntry.Flags flag)
Utility method that sets the value of the given flag to true.
|
void |
setLoaded(boolean loaded) |
void |
setMetadata(Metadata metadata)
Set the metadata in the cache entry.
|
void |
setRemoved(boolean removed) |
void |
setSkipLookup(boolean skipLookup)
|
void |
setValid(boolean valid) |
Object |
setValue(Object value)
Sets the value of the entry, returning the previous value
|
boolean |
skipLookup() |
String |
toString() |
boolean |
undelete(boolean doUndelete)
If the entry is marked as removed and doUndelete==true then the "valid" flag is set to true and "removed"
flag is set to false.
|
protected void |
unsetFlag(DeltaAwareCacheEntry.Flags flag)
Utility method that sets the value of the flag to false.
|
protected Object key
protected CacheEntry wrappedEntry
protected DeltaAware value
protected DeltaAware oldValue
protected byte flags
protected AtomicHashMap<?,?> uncommittedChanges
public DeltaAwareCacheEntry(Object key, DeltaAware value, CacheEntry wrappedEntry)
public byte getStateFlags()
getStateFlags in interface StateChangingEntrypublic void copyStateFlagsFrom(StateChangingEntry other)
copyStateFlagsFrom in interface StateChangingEntrypublic void appendDelta(Delta d)
public AtomicHashMap<?,?> getUncommittedChages()
protected final boolean isFlagSet(DeltaAwareCacheEntry.Flags flag)
flag - flag to testprotected final void setFlag(DeltaAwareCacheEntry.Flags flag)
flag - flag to setprotected final void unsetFlag(DeltaAwareCacheEntry.Flags flag)
flag - flag to unsetpublic final long getLifespan()
getLifespan in interface CacheEntrypublic final long getMaxIdle()
getMaxIdle in interface CacheEntrypublic boolean skipLookup()
skipLookup in interface CacheEntrytrue if the value must not be fetch from an external sourcepublic final Object getKey()
CacheEntrypublic final Object getValue()
CacheEntrypublic final Object setValue(Object value)
CacheEntrypublic boolean isNull()
CacheEntryisNull in interface CacheEntrypublic final void commit(DataContainer container, Metadata metadata)
CacheEntrycommit in interface CacheEntrycontainer - data container to commit topublic final void rollback()
CacheEntryrollback in interface CacheEntrypublic final boolean isChanged()
isChanged in interface CacheEntrypublic final void setChanged(boolean changed)
setChanged in interface CacheEntrypublic boolean isValid()
isValid in interface CacheEntrypublic final void setValid(boolean valid)
setValid in interface CacheEntrypublic final boolean isCreated()
isCreated in interface CacheEntrypublic final void setCreated(boolean created)
setCreated in interface CacheEntrypublic boolean isRemoved()
isRemoved in interface CacheEntrypublic boolean isEvicted()
isEvicted in interface CacheEntrypublic final void setRemoved(boolean removed)
setRemoved in interface CacheEntrypublic void setEvicted(boolean evicted)
setEvicted in interface CacheEntrypublic boolean isLoaded()
isLoaded in interface CacheEntrypublic void setLoaded(boolean loaded)
setLoaded in interface CacheEntrypublic void setSkipLookup(boolean skipLookup)
CacheEntrysetSkipLookup in interface CacheEntrypublic boolean undelete(boolean doUndelete)
CacheEntryundelete in interface CacheEntrypublic Metadata getMetadata()
MetadataAwaregetMetadata in interface MetadataAwarepublic void setMetadata(Metadata metadata)
MetadataAwaresetMetadata in interface MetadataAwaremetadata - to apply to the cache entryCopyright © 2014 JBoss, a division of Red Hat. All Rights Reserved.