Module org.eclipse.persistence.core
Class ThreadCursoredList<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList<E>
java.util.Vector<E>
org.eclipse.persistence.internal.helper.ThreadCursoredList<E>
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<E>,Collection<E>,List<E>,RandomAccess,SequencedCollection<E>
Special List/Vector subclass that allows concurrent
population of the contents while the list is in use.
The list will allow iteration while it is still being populated
to allow concurrent processing of the contents.
Other API such as size that require to full contents know will wait until
the list is notified as being complete.
This is use to allow the rows and objects of a read-all query to be processed concurrently.
- Since:
- OracleAS 10g TopLink (10.0.3)
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected RuntimeExceptionUsed to throw exception that occur from the concurrent population thread.protected booleanStore if the list is fully populated.Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementDataFields inherited from class java.util.AbstractList
modCount -
Constructor Summary
ConstructorsConstructorDescriptionConstruct an empty list so that its internal data array has size10and its standard capacity increment is zero.ThreadCursoredList(int initialCapacity) Construct an empty list with the specified initial capacity and with its capacity increment equal to zero.ThreadCursoredList(int initialCapacity, int capacityIncrement) Construct an empty list with the specified initial capacity and capacity increment. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd and notify any waiters that there are new elements.booleanAdd and notify any waiters that there are new elements.booleanaddAll(int index, Collection<? extends E> collection) Add and notify any waiters that there are new elements.booleanaddAll(Collection<? extends E> collection) Add and notify any waiters that there are new elements.voidaddElement(E object) Add and notify any waiters that there are new elements.voidclear()First wait until complete.clone()First wait until complete.booleanIf it does not contain the object must wait until it is complete.booleancontainsAll(Collection<?> collection) If it does not contain the object must wait until it is complete.voidFirst wait until complete.elementAt(int index) If the index is beyond the size wait until complete.elements()Allow concurrent streaming of the elements.booleanFirst wait until complete.Wait until has an element or is complete.get(int index) Wait until has the element or is complete.Return any exception that was throw from concurrent population thread.protected intgetSize()booleanReturn if any exception that was throw from concurrent population thread.inthashCode()First wait until complete.intIf does not contain the object wait until complete.intIf does not contain the object wait until complete.voidinsertElementAt(E element, int index) Add the element a notify any waiters that there are new elements.booleanReturn if the list is complete.booleanisEmpty()If empty wait until an element has been added or is complete.iterator()First wait until complete.intlastIndexOf(Object element) First wait until complete.intlastIndexOf(Object element, int index) First wait until complete.listIterator(int index) Iterate while waiting at end until complete.remove(int index) If index is missing wait until is there.booleanIf object is missing wait until complete.booleanremoveAll(Collection<?> collection) First wait until complete.voidFirst wait until complete.booleanremoveElement(Object element) If missing wait until complete.voidremoveElementAt(int index) If index is missing wait until reasched or complete.booleanretainAll(Collection<?> collection) First wait until complete.If index is missing wait until reached or complete.voidsetElementAt(E element, int index) If index is missing wait until reached or complete.voidsetIsComplete(boolean isComplete) Set the list complete and notify any waiters.intsize()First wait until complete.subList(int fromIndex, int toIndex) If index is missing wait until reached or complete.voidthrowException(RuntimeException exception) Record that the population thread hit an exception, that should be thrown to the processing thread on the next access.Object[]toArray()First wait until complete.<T> T[]toArray(T[] array) First wait until complete.toString()First wait until complete.voidFirst wait until complete.voidWait until a new element has been added.voidWait until the list has been fully populated.Methods inherited from class java.util.Vector
capacity, ensureCapacity, forEach, removeIf, removeRange, replaceAll, setSize, sort, spliteratorMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, stream, toArrayMethods inherited from interface java.util.List
addFirst, addLast, getFirst, getLast, removeFirst, removeLast, reversed
-
Field Details
-
isComplete
protected boolean isCompleteStore if the list is fully populated. -
exception
Used to throw exception that occur from the concurrent population thread.
-
-
Constructor Details
-
ThreadCursoredList
public ThreadCursoredList()Construct an empty list so that its internal data array has size10and its standard capacity increment is zero. -
ThreadCursoredList
public ThreadCursoredList(int initialCapacity) Construct an empty list with the specified initial capacity and with its capacity increment equal to zero. -
ThreadCursoredList
public ThreadCursoredList(int initialCapacity, int capacityIncrement) Construct an empty list with the specified initial capacity and capacity increment.
-
-
Method Details
-
add
Add and notify any waiters that there are new elements. -
add
Add and notify any waiters that there are new elements. -
addAll
Add and notify any waiters that there are new elements. -
addAll
Add and notify any waiters that there are new elements. -
addElement
Add and notify any waiters that there are new elements.- Overrides:
addElementin classVector<E>
-
clear
public void clear()First wait until complete. -
clone
First wait until complete. -
hasException
public boolean hasException()Return if any exception that was throw from concurrent population thread. -
getException
Return any exception that was throw from concurrent population thread. -
throwException
Record that the population thread hit an exception, that should be thrown to the processing thread on the next access. This also records the list and complete. -
isComplete
public boolean isComplete()Return if the list is complete. If an exception was thrown during the concurrent population throw the exception. -
setIsComplete
public void setIsComplete(boolean isComplete) Set the list complete and notify any waiters. -
waitUntilComplete
public void waitUntilComplete()Wait until the list has been fully populated. -
waitUntilAdd
public void waitUntilAdd()Wait until a new element has been added. -
contains
If it does not contain the object must wait until it is complete. -
containsAll
If it does not contain the object must wait until it is complete.- Specified by:
containsAllin interfaceCollection<E>- Specified by:
containsAllin interfaceList<E>- Overrides:
containsAllin classVector<E>
-
copyInto
First wait until complete. -
elementAt
If the index is beyond the size wait until complete. -
getSize
protected int getSize() -
elements
Allow concurrent streaming of the elements. -
equals
First wait until complete. -
firstElement
Wait until has an element or is complete.- Overrides:
firstElementin classVector<E>
-
get
Wait until has the element or is complete. -
hashCode
public int hashCode()First wait until complete. -
indexOf
If does not contain the object wait until complete. -
indexOf
If does not contain the object wait until complete. -
insertElementAt
Add the element a notify any waiters that there are new elements.- Overrides:
insertElementAtin classVector<E>
-
isEmpty
public boolean isEmpty()If empty wait until an element has been added or is complete. -
iterator
-
lastElement
First wait until complete.- Overrides:
lastElementin classVector<E>
-
lastIndexOf
First wait until complete.- Specified by:
lastIndexOfin interfaceList<E>- Overrides:
lastIndexOfin classVector<E>
-
lastIndexOf
First wait until complete.- Overrides:
lastIndexOfin classVector<E>
-
listIterator
- Specified by:
listIteratorin interfaceList<E>- Overrides:
listIteratorin classVector<E>
-
listIterator
Iterate while waiting at end until complete.- Specified by:
listIteratorin interfaceList<E>- Overrides:
listIteratorin classVector<E>
-
remove
If index is missing wait until is there. -
remove
If object is missing wait until complete. -
removeAll
First wait until complete. -
removeAllElements
public void removeAllElements()First wait until complete.- Overrides:
removeAllElementsin classVector<E>
-
removeElement
If missing wait until complete.- Overrides:
removeElementin classVector<E>
-
removeElementAt
public void removeElementAt(int index) If index is missing wait until reasched or complete.- Overrides:
removeElementAtin classVector<E>
-
retainAll
First wait until complete. -
set
If index is missing wait until reached or complete. -
setElementAt
If index is missing wait until reached or complete.- Overrides:
setElementAtin classVector<E>
-
size
public int size()First wait until complete. -
subList
If index is missing wait until reached or complete. -
toArray
First wait until complete. -
toArray
public <T> T[] toArray(T[] array) First wait until complete. -
toString
First wait until complete. -
trimToSize
public void trimToSize()First wait until complete.- Overrides:
trimToSizein classVector<E>
-