public class ConcurrentSegmentedStoredList<T> extends Object implements IStoredList<T>
Constructor and Description |
---|
ConcurrentSegmentedStoredList(boolean segmented) |
ConcurrentSegmentedStoredList(boolean segmented,
boolean supportFifoPerSegment) |
ConcurrentSegmentedStoredList(boolean segmented,
boolean supportFifoPerSegment,
boolean unidirectionalList,
int inputNumOfSegments) |
ConcurrentSegmentedStoredList(int inputNumOfSegments) |
Modifier and Type | Method and Description |
---|---|
IObjectInfo<T> |
add(T subject)
store an element
|
IObjectInfo<T> |
addUnlocked(T subject)
Store an element in the list, while the SL is unlocked .
|
boolean |
contains(T obj)
is this object contained in the SL ?
|
void |
dump(Logger logger,
String msg)
Dump list content, used for Debug.
|
IStoredListIterator<T> |
establishListScan(boolean randomScan)
establish a scan position.
|
void |
freeSLHolder(IStoredListIterator<T> slh)
this method is called by outside scan that want to quit the scan and return the slholder to
the factory
|
int |
getHashCode(int id) |
IObjectInfo<T> |
getHead()
Goes over all the segments and finds the "first" element.
|
Object |
getKey(int id) |
T |
getObjectFromHead()
Returns the value of the first element in the list (fifo)
|
IStoredList<T> |
getValue(int id) |
boolean |
invalidate()
Sets an indication that this StoredList is invalid.
|
boolean |
isEmpty()
Returns true if the list is empty
|
boolean |
isIterator()
is the list an iterator or basic list ?
|
boolean |
isMultiObjectCollection()
is it an actual multi object container.
|
boolean |
isNativeHashEntry() |
void |
monitor() |
IStoredListIterator<T> |
next(IStoredListIterator<T> slh)
get the next element in scan order
|
boolean |
optimizeScanForSingleObject()
return true if we can save iterator creation and get a single entry
|
void |
remove(IObjectInfo<T> poi)
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> poi)
Remove an element described by ObjectInfo, while the SL is unlocked.
|
int |
size()
Returns the amount of elements in the StoredList.
|
public ConcurrentSegmentedStoredList(boolean segmented, boolean supportFifoPerSegment, boolean unidirectionalList, int inputNumOfSegments)
public ConcurrentSegmentedStoredList(boolean segmented, boolean supportFifoPerSegment)
public ConcurrentSegmentedStoredList(boolean segmented)
public ConcurrentSegmentedStoredList(int inputNumOfSegments)
public int size()
ICollection
size
in interface ICollection<T>
ICollection.isEmpty()
public boolean isEmpty()
isEmpty
in interface ICollection<T>
true
if list is empty; false
otherwise.public IObjectInfo<T> add(T subject)
add
in interface ICollection<T>
subject
- element to store.null
if
StoredList has been invalidated.public IObjectInfo<T> addUnlocked(T subject)
IStoredList
addUnlocked
in interface IStoredList<T>
subject
- element to store.null
if
StoredList has been invalidated.public void remove(IObjectInfo<T> poi)
remove
in interface IStoredList<T>
poi
- an existing element between Tail and Headpublic void removeUnlocked(IObjectInfo<T> poi)
IStoredList
removeUnlocked
in interface IStoredList<T>
poi
- an existing element between Tail and Headpublic boolean contains(T obj)
contains
in interface ICollection<T>
obj
- the element to search fortrue
if element exists in the StoredList; false
otherwise.public boolean removeByObject(T obj)
removeByObject
in interface ICollection<T>
obj
- element to removetrue
if object was removed; false
otherwise (if element
wasn't found)public boolean invalidate()
invalidate
in interface IStoredList<T>
true
if StoredList was set to invalid; false
otherwise.public IObjectInfo<T> getHead()
getHead
in interface IStoredList<T>
public T getObjectFromHead()
IStoredList
getObjectFromHead
in interface IStoredList<T>
public boolean optimizeScanForSingleObject()
optimizeScanForSingleObject
in interface IStoredList<T>
public IStoredListIterator<T> establishListScan(boolean randomScan)
establishListScan
in interface ICollection<T>
randomScan
- true
enable random scan; false
start from head.public IStoredListIterator<T> next(IStoredListIterator<T> slh)
next
in interface ICollection<T>
slh
- Holder representing a pivot position.null
if reached end of scan.public boolean isMultiObjectCollection()
ICollection
isMultiObjectCollection
in interface ICollection<T>
true
if its an actual list; false
otherwisepublic boolean isIterator()
IObjectsList
isIterator
in interface IObjectsList
public void dump(Logger logger, String msg)
IStoredList
dump
in interface IStoredList<T>
logger
- logger to usemsg
- message to add in logpublic void freeSLHolder(IStoredListIterator<T> slh)
freeSLHolder
in interface IStoredList<T>
slh
- Holder resource to return to pool; can be null
.public void monitor()
public int getHashCode(int id)
getHashCode
in interface IHashEntry<Object,IStoredList<T>>
public Object getKey(int id)
getKey
in interface IHashEntry<Object,IStoredList<T>>
public IStoredList<T> getValue(int id)
getValue
in interface IHashEntry<Object,IStoredList<T>>
public boolean isNativeHashEntry()
isNativeHashEntry
in interface IHashEntry<Object,IStoredList<T>>
true
if this is a native hashmap entryCopyright © GigaSpaces.