public class DeltaAwareCacheEntry<K> extends Object implements CacheEntry<K,DeltaAware>, 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 K |
key |
protected DeltaAware |
oldValue |
protected AtomicHashMap<K,?> |
uncommittedChanges |
protected DeltaAware |
value |
protected CacheEntry<K,DeltaAware> |
wrappedEntry |
Constructor and Description |
---|
DeltaAwareCacheEntry(K key,
DeltaAware value,
CacheEntry<K,DeltaAware> wrappedEntry) |
Modifier and Type | Method and Description |
---|---|
void |
appendDelta(Delta d) |
DeltaAwareCacheEntry<K> |
clone() |
void |
commit(DataContainer<K,DeltaAware> container,
Metadata metadata)
Commits changes
|
void |
copyStateFlagsFrom(StateChangingEntry other) |
K |
getKey()
Retrieves the key to this entry
|
long |
getLifespan() |
long |
getMaxIdle() |
Metadata |
getMetadata()
Get metadata of this cache entry.
|
byte |
getStateFlags() |
AtomicHashMap<?,?> |
getUncommittedChages() |
DeltaAware |
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) |
DeltaAware |
setValue(DeltaAware 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.
|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
comparingByKey, comparingByKey, comparingByValue, comparingByValue, equals, hashCode
protected K key
protected CacheEntry<K,DeltaAware> wrappedEntry
protected DeltaAware value
protected DeltaAware oldValue
protected byte flags
protected AtomicHashMap<K,?> uncommittedChanges
public DeltaAwareCacheEntry(K key, DeltaAware value, CacheEntry<K,DeltaAware> wrappedEntry)
public byte getStateFlags()
getStateFlags
in interface StateChangingEntry
public void copyStateFlagsFrom(StateChangingEntry other)
copyStateFlagsFrom
in interface StateChangingEntry
public 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 CacheEntry<K,DeltaAware>
public final long getMaxIdle()
getMaxIdle
in interface CacheEntry<K,DeltaAware>
public boolean skipLookup()
skipLookup
in interface CacheEntry<K,DeltaAware>
true
if the value must not be fetch from an external sourcepublic final K getKey()
CacheEntry
getKey
in interface Map.Entry<K,DeltaAware>
getKey
in interface CacheEntry<K,DeltaAware>
public final DeltaAware getValue()
CacheEntry
getValue
in interface Map.Entry<K,DeltaAware>
getValue
in interface CacheEntry<K,DeltaAware>
public final DeltaAware setValue(DeltaAware value)
CacheEntry
setValue
in interface Map.Entry<K,DeltaAware>
setValue
in interface CacheEntry<K,DeltaAware>
value
- value to setpublic boolean isNull()
CacheEntry
isNull
in interface CacheEntry<K,DeltaAware>
public final void commit(DataContainer<K,DeltaAware> container, Metadata metadata)
CacheEntry
commit
in interface CacheEntry<K,DeltaAware>
container
- data container to commit topublic final void rollback()
CacheEntry
rollback
in interface CacheEntry<K,DeltaAware>
public final boolean isChanged()
isChanged
in interface CacheEntry<K,DeltaAware>
public final void setChanged(boolean changed)
setChanged
in interface CacheEntry<K,DeltaAware>
public boolean isValid()
isValid
in interface CacheEntry<K,DeltaAware>
public final void setValid(boolean valid)
setValid
in interface CacheEntry<K,DeltaAware>
public final boolean isCreated()
isCreated
in interface CacheEntry<K,DeltaAware>
public final void setCreated(boolean created)
setCreated
in interface CacheEntry<K,DeltaAware>
public boolean isRemoved()
isRemoved
in interface CacheEntry<K,DeltaAware>
public boolean isEvicted()
isEvicted
in interface CacheEntry<K,DeltaAware>
public final void setRemoved(boolean removed)
setRemoved
in interface CacheEntry<K,DeltaAware>
public void setEvicted(boolean evicted)
setEvicted
in interface CacheEntry<K,DeltaAware>
public boolean isLoaded()
isLoaded
in interface CacheEntry<K,DeltaAware>
public void setLoaded(boolean loaded)
setLoaded
in interface CacheEntry<K,DeltaAware>
public void setSkipLookup(boolean skipLookup)
CacheEntry
setSkipLookup
in interface CacheEntry<K,DeltaAware>
public boolean undelete(boolean doUndelete)
CacheEntry
undelete
in interface CacheEntry<K,DeltaAware>
public Metadata getMetadata()
MetadataAware
getMetadata
in interface MetadataAware
public void setMetadata(Metadata metadata)
MetadataAware
setMetadata
in interface MetadataAware
metadata
- to apply to the cache entrypublic DeltaAwareCacheEntry<K> clone()
clone
in interface CacheEntry<K,DeltaAware>
clone
in class Object
Copyright © 2022 JBoss, a division of Red Hat. All rights reserved.