public class SimpleLockStoredList<T> extends AbstractStoredList<T>
Modifier and Type | Field and Description |
---|---|
protected ReentrantSimpleLock |
lock |
m_AllOccupiedPos, m_BasicOccupied, m_Head, m_LastChunk, m_LastPos, m_Size, m_Support_Random_Scans, m_Tail, MINIMAL_NUMBER_TO_HANDLE_POSITIONS, NUMBER_OF_OCCUPIED_POS_QUOTA, SCAN_LIMIT
Constructor and Description |
---|
SimpleLockStoredList(boolean Support_Random_Scans) |
SimpleLockStoredList(boolean Support_Random_Scans,
IReusableResourcePool<ReadWriteLock> locksPool)
Create new stored list that will use the given ReadWriteLock for synchronization.
|
Modifier and Type | Method and Description |
---|---|
IObjectInfo<T> |
add(T subject)
store an element
|
IObjectInfo<T> |
addUnlocked(T subject)
store an element, while the SL is unlocked
|
boolean |
contains(T obj)
is this object contained in the SL ?
|
int |
getHashCode(int id) |
IObjectInfo<T> |
getHead()
get head of SL
|
Object |
getKey(int id) |
T |
getObjectFromHead()
get object from head of SL
|
IStoredList<T> |
getValue(int id) |
boolean |
invalidate()
Sets an indication that this StoredList is invalid.
|
boolean |
isEmpty()
Returns true if this list is empty, i.e.
|
protected boolean |
isInvalid() |
boolean |
isNativeHashEntry() |
protected boolean |
iterate(boolean random_scan,
StoredListIterator<T> res) |
boolean |
nextPos(StoredListIterator<T> slh) |
boolean |
optimizeScanForSingleObject()
return true if we can save iterator creation and get a single entry
|
void |
remove(IObjectInfo<T> oi)
remove an element described by ObjectInfo
|
boolean |
removeByObject(T obj)
given an object scan the list, find it and remove it, returns true if found
|
void |
removeUnlocked(IObjectInfo<T> oi)
remove an element described by ObjectInfo, while the SL is unlocked
|
int |
size()
Returns the amount of elements in the StoredList.
|
contains_impl, dump, establishListScan, freeSLHolder, isIterator, isMultiObjectCollection, iterator, iterator, next, remove_impl, removeByObject_impl, store_impl, storeBeforeCeiling_impl
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
protected final ReentrantSimpleLock lock
public SimpleLockStoredList(boolean Support_Random_Scans)
public SimpleLockStoredList(boolean Support_Random_Scans, IReusableResourcePool<ReadWriteLock> locksPool)
public int size()
ICollection
ICollection.isEmpty()
public boolean optimizeScanForSingleObject()
public boolean isEmpty()
ICollection
true
if list is empty; false
otherwise.public IObjectInfo<T> getHead()
public T getObjectFromHead()
protected boolean iterate(boolean random_scan, StoredListIterator<T> res)
iterate
in class AbstractStoredList<T>
public boolean nextPos(StoredListIterator<T> slh)
nextPos
in class AbstractStoredList<T>
public IObjectInfo<T> add(T subject)
subject
- element to store.null
if
StoredList has been invalidated.public IObjectInfo<T> addUnlocked(T subject)
subject
- element to store.null
if
StoredList has been invalidated.public void remove(IObjectInfo<T> oi)
oi
- an existing element between Tail and Headpublic void removeUnlocked(IObjectInfo<T> oi)
oi
- an existing element between Tail and Headpublic boolean removeByObject(T obj)
obj
- element to removetrue
if object was removed; false
otherwise (if element
wasn't found)public boolean contains(T obj)
obj
- the element to search fortrue
if element exists in the StoredList; false
otherwise.public boolean invalidate()
true
if StoredList was set to invalid; false
otherwise.protected boolean isInvalid()
isInvalid
in class AbstractStoredList<T>
public int getHashCode(int id)
public Object getKey(int id)
public IStoredList<T> getValue(int id)
public boolean isNativeHashEntry()
true
if this is a native hashmap entryCopyright © GigaSpaces.