Package com.j_spaces.core.cache
Class MemoryBasedEntryCacheInfo
java.lang.Object
com.j_spaces.core.cache.MemoryBasedEntryCacheInfo
- All Implemented Interfaces:
IHashEntry<Object,,IStoredList<IEntryCacheInfo>> EvictableServerEntry,ServerEntry,IEntryCacheInfo,ILeasedEntryCacheInfo,ICollection<IEntryCacheInfo>,IObjectInfo<IEntryCacheInfo>,IStoredList<IEntryCacheInfo>,IStoredListIterator<IEntryCacheInfo>,IObjectsList,IScanListIterator<IEntryCacheInfo>
- Direct Known Subclasses:
EvictableEntryCacheInfo,MVCCEntryCacheInfo,MVCCShellEntryCacheInfo
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMemoryBasedEntryCacheInfo(IEntryHolder entryHolder) Const used only for snapshots, called from CacheManager.prePrepare(Context, ServerTransaction).MemoryBasedEntryCacheInfo(IEntryHolder entryHolder, int backRefsSize) -
Method Summary
Modifier and TypeMethodDescriptionadd(IEntryCacheInfo subject) Store an element in the list.addUnlocked(IEntryCacheInfo subject) Store an element in the list, while the SL is unlocked .booleancontains(IEntryCacheInfo obj) Checks whether it contains the specified element.voidDump list content, used for Debug.establishListScan(boolean random_scan) establish a scan position.voidCalled by an outside scan that wants to quit the scan and return the slholder to the resource pool.intif the scan is on a property index, currently supported for extended indexgetEntryHolder(CacheManager cacheManager) getEntryHolder(CacheManager cacheManager, Context context) in order to avoid searching the eviction handler data structures when an existing entry is rendered to it by the space cache manager, the eviction-handler may store a backref to the entry in it data structure and retrieve it laterlongGets the entry expiration time.getFixedPropertyValue(int position) Gets the specified fixed property's value.intgetHashCode(int id) getHead()Returns the first element in the list (fifo)getKey(int id) intReturns the value of the first element in the list (fifo)getPathValue(String path) Gets the specified path's value.getPropertyValue(String name) Gets the specified property's value.Gets the entry's type descriptor.Gets the subject pointed to by the cursor's scan.getUID()Returns the entry unique space identifier.getValue(int id) intGets the entry version.booleanhasNext()booleanbooleanSets an indication that this StoredList is invalid.booleanis the entry returned already matched against the searching template currently is true if the underlying scan made by CacheManager::EntriesIterbooleanbooleanbooleanbooleanisEmpty()Returns true if this list is empty, i.e.booleanbooleanbooleanis the list an iterator or basic list ?booleanis it an actual multi object container.booleanbooleanisPinned()booleanbooleanbooleanbooleanbooleanbooleannext()Returns the next element in the scan order.booleanreturn true if we can save iterator creation and get a single entrybooleanpreMatch(Context context, ITemplateHolder template) voidrelease()Release of this SLHolder resourcevoidrelease SLHolder for this scanvoidremove(IObjectInfo oi) Remove an element described by ObjectInfo.booleanGiven an element scan the list, find it and remove it.voidRemove an element described by ObjectInfo, while the SL is unlocked.voidsetBackRefs(ArrayList<IObjectInfo<IEntryCacheInfo>> backRefs) voidsetEvictionPayLoad(Object evictionBackRef) in order to avoid searching the eviction handler data structures when an existing entry is rendered to it by the space cache manager, the eviction-handler may store a backref to the entry in it data structure and retrieve it latervoidsetInCache(boolean checkPendingPin) voidsetLatestIndexCreationNumber(int val) voidsetLeaseManagerListRefAndPosition(IStoredList<Object> entriesList, IObjectInfo<Object> entryPos) voidsetMainListBackRef(IObjectInfo<IEntryCacheInfo> mainListBackref) booleansetPinned(boolean value) booleansetPinned(boolean value, boolean waitIfPendingInsertion) voidvoidbooleansetRemoving(boolean isPinned) voidsetSubject(IEntryCacheInfo subject) Sets the subject for this node.booleanMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.j_spaces.kernel.ICollection
establishListScanMethods inherited from interface com.j_spaces.core.cache.IEntryCacheInfo
hasSize, sizeMethods inherited from interface com.j_spaces.kernel.list.IScanListIterator
createCopyForAlternatingThread, getAlreadyMatchedIndexPath, isExtensionIndex, isMultiListsIterator, noRematchNeeded
-
Field Details
-
UID_HASH_INDICATOR
public static final int UID_HASH_INDICATOR- See Also:
-
-
Constructor Details
-
MemoryBasedEntryCacheInfo
Const used only for snapshots, called from CacheManager.prePrepare(Context, ServerTransaction). Assuming no need for the m_BackRefs ArrayList. -
MemoryBasedEntryCacheInfo
-
-
Method Details
-
getEntryHolder
- Specified by:
getEntryHolderin interfaceIEntryCacheInfo- Returns:
- the m_EntryHolder.
-
getEntryHolder
-
getEntryHolder
- Specified by:
getEntryHolderin interfaceIEntryCacheInfo
-
isDeleted
public boolean isDeleted()- Specified by:
isDeletedin interfaceIEntryCacheInfo- Returns:
- true if the entry is deleted
-
getBackRefs
- Specified by:
getBackRefsin interfaceIEntryCacheInfo- Returns:
- Returns the m_BackRefs.
-
setBackRefs
- Specified by:
setBackRefsin interfaceIEntryCacheInfo
-
getMainListBackRef
- Specified by:
getMainListBackRefin interfaceIEntryCacheInfo
-
indexesBackRefsKept
public boolean indexesBackRefsKept()- Specified by:
indexesBackRefsKeptin interfaceIEntryCacheInfo
-
setMainListBackRef
- Specified by:
setMainListBackRefin interfaceIEntryCacheInfo
-
setLeaseManagerListRefAndPosition
public void setLeaseManagerListRefAndPosition(IStoredList<Object> entriesList, IObjectInfo<Object> entryPos) - Specified by:
setLeaseManagerListRefAndPositionin interfaceIEntryCacheInfo- Specified by:
setLeaseManagerListRefAndPositionin interfaceILeasedEntryCacheInfo
-
getLeaseManagerListRef
- Specified by:
getLeaseManagerListRefin interfaceIEntryCacheInfo- Specified by:
getLeaseManagerListRefin interfaceILeasedEntryCacheInfo
-
getLeaseManagerPosition
- Specified by:
getLeaseManagerPositionin interfaceIEntryCacheInfo- Specified by:
getLeaseManagerPositionin interfaceILeasedEntryCacheInfo
-
isConnectedToLeaseManager
public boolean isConnectedToLeaseManager()- Specified by:
isConnectedToLeaseManagerin interfaceIEntryCacheInfo- Specified by:
isConnectedToLeaseManagerin interfaceILeasedEntryCacheInfo
-
isSameLeaseManagerRef
- Specified by:
isSameLeaseManagerRefin interfaceIEntryCacheInfo- Specified by:
isSameLeaseManagerRefin interfaceILeasedEntryCacheInfo
-
isBlobStoreEntry
public boolean isBlobStoreEntry()- Specified by:
isBlobStoreEntryin interfaceILeasedEntryCacheInfo
-
getObjectStoredInLeaseManager
- Specified by:
getObjectStoredInLeaseManagerin interfaceILeasedEntryCacheInfo
-
getServerTypeDesc
- Specified by:
getServerTypeDescin interfaceIEntryCacheInfo
-
getLatestIndexCreationNumber
public int getLatestIndexCreationNumber()- Specified by:
getLatestIndexCreationNumberin interfaceIEntryCacheInfo
-
setLatestIndexCreationNumber
public void setLatestIndexCreationNumber(int val) - Specified by:
setLatestIndexCreationNumberin interfaceIEntryCacheInfo
-
getClassName
- Specified by:
getClassNamein interfaceIEntryCacheInfo
-
setEvictionPayLoad
in order to avoid searching the eviction handler data structures when an existing entry is rendered to it by the space cache manager, the eviction-handler may store a backref to the entry in it data structure and retrieve it later- Specified by:
setEvictionPayLoadin interfaceEvictableServerEntry
-
getEvictionPayLoad
in order to avoid searching the eviction handler data structures when an existing entry is rendered to it by the space cache manager, the eviction-handler may store a backref to the entry in it data structure and retrieve it later- Specified by:
getEvictionPayLoadin interfaceEvictableServerEntry- Returns:
- the eviction back-ref to the entry, or null if not stored
-
isTransient
public boolean isTransient() -
getUID
Description copied from interface:EvictableServerEntryReturns the entry unique space identifier.- Specified by:
getUIDin interfaceEvictableServerEntry
-
setInCache
public void setInCache(boolean checkPendingPin) - Specified by:
setInCachein interfaceIEntryCacheInfo
-
isInCache
public boolean isInCache() -
isInserted
public boolean isInserted() -
setPinned
public boolean setPinned(boolean value, boolean waitIfPendingInsertion) - Specified by:
setPinnedin interfaceIEntryCacheInfo
-
setPinned
public boolean setPinned(boolean value) - Specified by:
setPinnedin interfaceIEntryCacheInfo
-
isPinned
public boolean isPinned()- Specified by:
isPinnedin interfaceIEntryCacheInfo
-
setRemoving
public boolean setRemoving(boolean isPinned) - Specified by:
setRemovingin interfaceIEntryCacheInfo
-
isRemoving
public boolean isRemoving()- Specified by:
isRemovingin interfaceIEntryCacheInfo
-
setRemoved
public void setRemoved()- Specified by:
setRemovedin interfaceIEntryCacheInfo
-
isRemoved
public boolean isRemoved()- Specified by:
isRemovedin interfaceIEntryCacheInfo
-
isRemovingOrRemoved
public boolean isRemovingOrRemoved()- Specified by:
isRemovingOrRemovedin interfaceIEntryCacheInfo
-
wasInserted
public boolean wasInserted()- Specified by:
wasInsertedin interfaceIEntryCacheInfo
-
isRecentDelete
public boolean isRecentDelete()- Specified by:
isRecentDeletein interfaceIEntryCacheInfo
-
setRecentDelete
public void setRecentDelete()- Specified by:
setRecentDeletein interfaceIEntryCacheInfo
-
preMatch
- Specified by:
preMatchin interfaceIEntryCacheInfo
-
getHead
Description copied from interface:IStoredListReturns the first element in the list (fifo)- Specified by:
getHeadin interfaceIStoredList<IEntryCacheInfo>- Returns:
- the head of the list
-
getObjectFromHead
Description copied from interface:IStoredListReturns the value of the first element in the list (fifo)- Specified by:
getObjectFromHeadin interfaceIStoredList<IEntryCacheInfo>- Returns:
- the value of the head of the list
-
freeSLHolder
Description copied from interface:IStoredListCalled by an outside scan that wants to quit the scan and return the slholder to the resource pool.- Specified by:
freeSLHolderin interfaceIStoredList<IEntryCacheInfo>- Parameters:
slh- Holder resource to return to pool; can benull.
-
remove
Description copied from interface:IStoredListRemove an element described by ObjectInfo. [Tail] - .. - [beforeOi] - [oi] - [afterOi] - .. - [Head]- Specified by:
removein interfaceIStoredList<IEntryCacheInfo>- Parameters:
oi- an existing element between Tail and Head
-
removeUnlocked
Description copied from interface:IStoredListRemove an element described by ObjectInfo, while the SL is unlocked. [Tail] - .. - [beforeOi] - [oi] - [afterOi] - .. - [Head]- Specified by:
removeUnlockedin interfaceIStoredList<IEntryCacheInfo>- Parameters:
oi- an existing element between Tail and Head
-
invalidate
public boolean invalidate()Description copied from interface:IStoredListSets an indication that this StoredList is invalid. if isEmpty() returns true, the indication is set; otherwise the indication remains false. Called by PersistentGC when scanning for empty StoredList that can be garbage collected.- Specified by:
invalidatein interfaceIStoredList<IEntryCacheInfo>- Returns:
trueif StoredList was set to invalid;falseotherwise.
-
dump
Description copied from interface:IStoredListDump list content, used for Debug.- Specified by:
dumpin interfaceIStoredList<IEntryCacheInfo>- Parameters:
logger- logger to usemsg- message to add in log
-
isEmpty
public boolean isEmpty()Description copied from interface:ICollectionReturns true if this list is empty, i.e. has no elements. [Tail] - [Head]- Specified by:
isEmptyin interfaceICollection<IEntryCacheInfo>- Returns:
trueif list is empty;falseotherwise.
-
establishListScan
Description copied from interface:ICollectionestablish a scan position. if random scan is supported we select a random position; otherwise we return the first resource by scanning from head to tail.- Specified by:
establishListScanin interfaceICollection<IEntryCacheInfo>- Parameters:
random_scan-trueenable random scan;falsestart from head.- Returns:
- a Holder for this scan. This Resource should be released if scan ended prematurely.
-
next
Description copied from interface:ICollectionReturns the next element in the scan order. Calling this method until it returns null, will return each element as part of theSLHolders subject.- Specified by:
nextin interfaceICollection<IEntryCacheInfo>- Parameters:
slh- Holder representing a pivot position.- Returns:
- the next pivot position in this scan;
nullif reached end of scan.
-
add
Description copied from interface:ICollectionStore an element in the list. New elements are inserted at the tail.- Specified by:
addin interfaceICollection<IEntryCacheInfo>- Parameters:
subject- element to store.- Returns:
- an information node representing the inserted element;
nullif StoredList has been invalidated.
-
addUnlocked
Description copied from interface:IStoredListStore an element in the list, while the SL is unlocked . New elements are inserted at the tail.- Specified by:
addUnlockedin interfaceIStoredList<IEntryCacheInfo>- Parameters:
subject- element to store.- Returns:
- an information node representing the inserted element;
nullif StoredList has been invalidated.
-
removeByObject
Description copied from interface:ICollectionGiven an element scan the list, find it and remove it.- Specified by:
removeByObjectin interfaceICollection<IEntryCacheInfo>- Parameters:
obj- element to remove- Returns:
trueif object was removed;falseotherwise (if element wasn't found)
-
contains
Description copied from interface:ICollectionChecks whether it contains the specified element.- Specified by:
containsin interfaceICollection<IEntryCacheInfo>- Parameters:
obj- the element to search for- Returns:
trueif element exists in the StoredList;falseotherwise.
-
setSubject
Description copied from interface:IObjectInfoSets the subject for this node.- Specified by:
setSubjectin interfaceIObjectInfo<IEntryCacheInfo>- Specified by:
setSubjectin interfaceIStoredListIterator<IEntryCacheInfo>- Parameters:
subject- The subject to set.
-
getSubject
Description copied from interface:IStoredListIteratorGets the subject pointed to by the cursor's scan.- Specified by:
getSubjectin interfaceIObjectInfo<IEntryCacheInfo>- Specified by:
getSubjectin interfaceIStoredListIterator<IEntryCacheInfo>- Returns:
- Returns the subject at this node.
-
isMultiObjectCollection
public boolean isMultiObjectCollection()Description copied from interface:ICollectionis it an actual multi object container.- Specified by:
isMultiObjectCollectionin interfaceICollection<IEntryCacheInfo>- Returns:
trueif its an actual list;falseotherwise
-
optimizeScanForSingleObject
public boolean optimizeScanForSingleObject()return true if we can save iterator creation and get a single entry- Specified by:
optimizeScanForSingleObjectin interfaceIStoredList<IEntryCacheInfo>- Returns:
- true if we can optimize
-
hasNext
- Specified by:
hasNextin interfaceIScanListIterator<IEntryCacheInfo>- Throws:
SAException
-
next
- Specified by:
nextin interfaceIScanListIterator<IEntryCacheInfo>- Throws:
SAException
-
releaseScan
release SLHolder for this scan- Specified by:
releaseScanin interfaceIScanListIterator<IEntryCacheInfo>- Throws:
SAException
-
getAlreadyMatchedFixedPropertyIndexPos
public int getAlreadyMatchedFixedPropertyIndexPos()if the scan is on a property index, currently supported for extended index- Specified by:
getAlreadyMatchedFixedPropertyIndexPosin interfaceIScanListIterator<IEntryCacheInfo>
-
isAlreadyMatched
public boolean isAlreadyMatched()is the entry returned already matched against the searching template currently is true if the underlying scan made by CacheManager::EntriesIter- Specified by:
isAlreadyMatchedin interfaceIScanListIterator<IEntryCacheInfo>
-
isIterator
public boolean isIterator()Description copied from interface:IObjectsListis the list an iterator or basic list ?- Specified by:
isIteratorin interfaceIObjectsList
-
getSpaceTypeDescriptor
Gets the entry's type descriptor.- Specified by:
getSpaceTypeDescriptorin interfaceServerEntry- Returns:
- Current entry's type descriptor.
-
getFixedPropertyValue
Gets the specified fixed property's value.- Specified by:
getFixedPropertyValuein interfaceServerEntry- Parameters:
position- Position of requested property.- Returns:
- Requested property's value in current entry.
-
getPropertyValue
Gets the specified property's value.- Specified by:
getPropertyValuein interfaceServerEntry- Parameters:
name- Name of requested property.- Returns:
- Requested property's value in current entry.
-
getPathValue
Description copied from interface:ServerEntryGets the specified path's value. The returned value is a reference to the actual property kept in the space.- Specified by:
getPathValuein interfaceServerEntry- Parameters:
path- Path pointing to the requested property.- Returns:
- Requested path's value in current entry.
-
getVersion
public int getVersion()Gets the entry version.- Specified by:
getVersionin interfaceServerEntry- Returns:
- the entry version.
- Since:
- 9.0.0
-
getExpirationTime
public long getExpirationTime()Gets the entry expiration time.- Specified by:
getExpirationTimein interfaceServerEntry- Returns:
- the entry expiration time.
- Since:
- 9.0.0
-
getHashCode
public int getHashCode(int id) - Specified by:
getHashCodein interfaceIHashEntry<Object,IStoredList<IEntryCacheInfo>>
-
getKey
- Specified by:
getKeyin interfaceIHashEntry<Object,IStoredList<IEntryCacheInfo>>
-
getValue
- Specified by:
getValuein interfaceIHashEntry<Object,IStoredList<IEntryCacheInfo>>
-
isNativeHashEntry
public boolean isNativeHashEntry()- Specified by:
isNativeHashEntryin interfaceIHashEntry<Object,IStoredList<IEntryCacheInfo>> - Returns:
trueif this is a native hashmap entry
-
release
public void release()Description copied from interface:IStoredListIteratorRelease of this SLHolder resource- Specified by:
releasein interfaceIStoredListIterator<IEntryCacheInfo>- See Also:
-