public class Entry<K,T> extends Object implements org.cache2k.CacheEntry<K,T>, StorageEntry, ExaminationEntry<K,T>
When an entry is present and its value is updated, the entry objects stays the same. The entry object is used for locking and coordination of all concurrent accesses to it.
The entry is only used as CacheEntry directly and handed to the
application when it is locked and the values are stable, that is for example
when the loader is called.
| Modifier and Type | Class and Description |
|---|---|
static class |
Entry.ProcessingState
Different possible processing states.
|
| Modifier and Type | Field and Description |
|---|---|
Entry<K,T> |
another
Hash implementation: Link to another entry in the same hash table slot when the hash code collides.
|
static int |
EXPIRY_TIME_MIN
A value greater as means it is a time value.
|
int |
hashCode
Hash implementation: the calculated, modified hash code, retrieved from the key when the entry is
inserted in the cache
|
long |
hitCnt
Hit counter.
|
protected static org.cache2k.core.CompactEntry.InitialValueInEntryNeverReturned |
INITIAL_VALUE |
Entry |
next
Lru list: pointer to next element or list head
|
protected long |
nextRefreshTime
Contains the next time a refresh has to occur, or if no background refresh is configured, when the entry
is expired.
|
Entry |
prev
Lru list: pointer to previous element or list head
|
| Modifier and Type | Method and Description |
|---|---|
static boolean |
checkCyclicListIntegrity(Entry e) |
void |
ensureAbort(boolean _finished)
Make sure entry processing is properly finished, otherwise threads waiting for
an entry get stuck.
|
boolean |
equalsValue(T v) |
long |
getCreatedOrUpdated()
Used for the storage interface.
|
static int |
getCyclicListEntryCount(Entry e) |
long |
getEntryExpiryTime()
Deprecated.
Always returns 0, only to fulfill the
StorageEntry interface |
Throwable |
getException() |
K |
getKey() |
K |
getKeyObj()
Get the raw object reference.
|
long |
getLastModification()
Deprecated.
|
long |
getNextRefreshTime() |
<X> X |
getPiggyBack(Class<X> _class) |
int |
getProcessingState() |
long |
getRefreshProbationNextRefreshTime() |
long |
getRefreshTime() |
org.cache2k.integration.ExceptionInformation |
getSuppressedLoadExceptionInformation() |
SimpleTimerTask |
getTask() |
T |
getValue()
Deprecated.
|
long |
getValueExpiryTime()
Expiry time or 0.
|
T |
getValueOrException()
The value of the entry or an
ExceptionWrapper. |
boolean |
hasFreshData(InternalClock t)
Returns true if the entry has a valid value and is fresh / not expired.
|
static void |
insertInList(Entry _head,
Entry e) |
static <E extends Entry> |
insertIntoTailCyclicList(E _head,
E e) |
boolean |
isDataValid()
The entry value was fetched and is valid, which means it can be
returned by the cache.
|
boolean |
isExpired()
The entry expired, still in the cache and subject to removal from the cache
if
HeapCache.isKeepAfterExpired() is false. |
boolean |
isGettingRefresh() |
boolean |
isGone()
The entry is not present in the heap any more and was evicted, expired or removed.
|
boolean |
isHot() |
boolean |
isNotYetInsertedInReplacementList()
Entry was not inserted into the replacement list AND not removed from replacement list.
|
boolean |
isProcessing() |
boolean |
isRemovedFromReplacementList()
Check that this entry is removed from the list, may be used in assertions.
|
boolean |
isVirgin()
Initial state of an entry.
|
boolean |
needsTimeCheck() |
void |
nextProcessingStep(int ps)
Switch to another processing state that is other then done.
|
static String |
num2processingStateText(int ps) |
void |
processingDone()
Set processing state to done and notify all that wait for
processing this entry.
|
void |
removedFromList()
Reset next as a marker for
isRemovedFromReplacementList() |
static <E extends Entry> |
removeFromCyclicList(E _head,
E e) |
static Entry |
removeFromCyclicList(Entry e) |
static void |
removeFromList(Entry e) |
void |
resetSuppressedLoadExceptionInformation()
If the entry carries information about a suppressed exception, clear it.
|
void |
setExpiredState()
Entry is kept in the cache but has expired
|
void |
setGone() |
void |
setHot(boolean f) |
void |
setNextRefreshTime(long _nextRefreshTime) |
void |
setRefreshProbationNextRefreshTime(long nrt) |
void |
setRefreshTime(long t)
Set modification time and marks entry as dirty.
|
void |
setSuppressedLoadExceptionInformation(org.cache2k.integration.ExceptionInformation w) |
void |
setTask(SimpleTimerTask v) |
void |
setValueOrException(T _valueOrException) |
Entry |
shortCircuit() |
void |
startProcessing(int ps)
Starts long operation on entry.
|
String |
toString() |
String |
toString(HeapCache c) |
void |
waitForProcessing() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetKey, getValueOrExceptiongetKey, getValueOrExceptionpublic static final int EXPIRY_TIME_MIN
public Entry next
public Entry prev
protected static final org.cache2k.core.CompactEntry.InitialValueInEntryNeverReturned INITIAL_VALUE
protected volatile long nextRefreshTime
public final int hashCode
HeapCache.modifiedHash(int)public Entry<K,T> another
public long hitCnt
HeapCache.recordHit(Entry)public Entry(K _key, int _hashCode)
public Entry()
public void setRefreshTime(long t)
public long getRefreshTime()
getRefreshTime in interface ExaminationEntry<K,T>@Deprecated public long getLastModification()
public static String num2processingStateText(int ps)
public int getProcessingState()
public void startProcessing(int ps)
public void nextProcessingStep(int ps)
public void processingDone()
public long getNextRefreshTime()
public void setNextRefreshTime(long _nextRefreshTime)
public void ensureAbort(boolean _finished)
Usually no exceptions happens, but the CacheClosedException is happening out of order and stops processing to properly finish.
public boolean isProcessing()
public void waitForProcessing()
public boolean isGettingRefresh()
public final void removedFromList()
isRemovedFromReplacementList()public boolean isRemovedFromReplacementList()
public boolean isNotYetInsertedInReplacementList()
public Entry shortCircuit()
public final boolean isVirgin()
public final boolean isDataValid()
Even if this is true, the data may be expired. Use hasFreshData() to make sure to get not expired data.
public final boolean hasFreshData(InternalClock t)
public void setExpiredState()
public boolean isExpired()
HeapCache.isKeepAfterExpired() is false.public void setGone()
public boolean isGone()
public boolean needsTimeCheck()
public boolean isHot()
public void setHot(boolean f)
public long getValueExpiryTime()
getValueExpiryTime in interface StorageEntrypublic long getCreatedOrUpdated()
getCreatedOrUpdated in interface StorageEntryStorageEntrypublic long getEntryExpiryTime()
StorageEntry interfacegetEntryExpiryTime in interface StorageEntryStorageEntrypublic SimpleTimerTask getTask()
public <X> X getPiggyBack(Class<X> _class)
public void setTask(SimpleTimerTask v)
public void setSuppressedLoadExceptionInformation(org.cache2k.integration.ExceptionInformation w)
public void resetSuppressedLoadExceptionInformation()
public org.cache2k.integration.ExceptionInformation getSuppressedLoadExceptionInformation()
public void setRefreshProbationNextRefreshTime(long nrt)
public long getRefreshProbationNextRefreshTime()
public static void removeFromList(Entry e)
public static <E extends Entry> E insertIntoTailCyclicList(E _head, E e)
public static <E extends Entry> E removeFromCyclicList(E _head, E e)
public static int getCyclicListEntryCount(Entry e)
public static boolean checkCyclicListIntegrity(Entry e)
public void setValueOrException(T _valueOrException)
public Throwable getException()
public boolean equalsValue(T v)
@Deprecated public T getValue()
public T getValueOrException()
ExceptionWrapper.public K getKey()
public K getKeyObj()
null for the IntHeapCache.cache2k API documentation. Copyright © 2000–2019 headissue GmbH, Munich.