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
Modifier and TypeFieldDescriptionprotected RuntimeException
Used to throw exception that occur from the concurrent population thread.protected boolean
Store if the list is fully populated.Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
Fields inherited from class java.util.AbstractList
modCount
-
Constructor Summary
ConstructorDescriptionConstruct an empty list so that its internal data array has size10
and 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 TypeMethodDescriptionvoid
Add and notify any waiters that there are new elements.boolean
Add and notify any waiters that there are new elements.boolean
addAll
(int index, Collection<? extends E> collection) Add and notify any waiters that there are new elements.boolean
addAll
(Collection<? extends E> collection) Add and notify any waiters that there are new elements.void
addElement
(E object) Add and notify any waiters that there are new elements.void
clear()
First wait until complete.clone()
First wait until complete.boolean
If it does not contain the object must wait until it is complete.boolean
containsAll
(Collection<?> collection) If it does not contain the object must wait until it is complete.void
First wait until complete.elementAt
(int index) If the index is beyond the size wait until complete.elements()
Allow concurrent streaming of the elements.boolean
First 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 int
getSize()
boolean
Return if any exception that was throw from concurrent population thread.int
hashCode()
First wait until complete.int
If does not contain the object wait until complete.int
If does not contain the object wait until complete.void
insertElementAt
(E element, int index) Add the element a notify any waiters that there are new elements.boolean
Return if the list is complete.boolean
isEmpty()
If empty wait until an element has been added or is complete.iterator()
First wait until complete.int
lastIndexOf
(Object element) First wait until complete.int
lastIndexOf
(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.boolean
If object is missing wait until complete.boolean
removeAll
(Collection<?> collection) First wait until complete.void
First wait until complete.boolean
removeElement
(Object element) If missing wait until complete.void
removeElementAt
(int index) If index is missing wait until reasched or complete.boolean
retainAll
(Collection<?> collection) First wait until complete.If index is missing wait until reached or complete.void
setElementAt
(E element, int index) If index is missing wait until reached or complete.void
setIsComplete
(boolean isComplete) Set the list complete and notify any waiters.int
size()
First wait until complete.subList
(int fromIndex, int toIndex) If index is missing wait until reached or complete.void
throwException
(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.void
First wait until complete.void
Wait until a new element has been added.void
Wait until the list has been fully populated.Methods inherited from class java.util.Vector
capacity, ensureCapacity, forEach, removeIf, removeRange, replaceAll, setSize, sort, spliterator
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, stream, toArray
Methods 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 size10
and 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:
addElement
in 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:
containsAll
in interfaceCollection<E>
- Specified by:
containsAll
in interfaceList<E>
- Overrides:
containsAll
in 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:
firstElement
in 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:
insertElementAt
in 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:
lastElement
in classVector<E>
-
lastIndexOf
First wait until complete.- Specified by:
lastIndexOf
in interfaceList<E>
- Overrides:
lastIndexOf
in classVector<E>
-
lastIndexOf
First wait until complete.- Overrides:
lastIndexOf
in classVector<E>
-
listIterator
- Specified by:
listIterator
in interfaceList<E>
- Overrides:
listIterator
in classVector<E>
-
listIterator
Iterate while waiting at end until complete.- Specified by:
listIterator
in interfaceList<E>
- Overrides:
listIterator
in 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:
removeAllElements
in classVector<E>
-
removeElement
If missing wait until complete.- Overrides:
removeElement
in classVector<E>
-
removeElementAt
public void removeElementAt(int index) If index is missing wait until reasched or complete.- Overrides:
removeElementAt
in 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:
setElementAt
in 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:
trimToSize
in classVector<E>
-