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>

public class ThreadCursoredList<E> extends Vector<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 Details

    • isComplete

      protected boolean isComplete
      Store if the list is fully populated.
    • exception

      protected RuntimeException 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 size 10 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

      public void add(int index, E element)
      Add and notify any waiters that there are new elements.
      Specified by:
      add in interface List<E>
      Overrides:
      add in class Vector<E>
    • add

      public boolean add(E element)
      Add and notify any waiters that there are new elements.
      Specified by:
      add in interface Collection<E>
      Specified by:
      add in interface List<E>
      Overrides:
      add in class Vector<E>
    • addAll

      public boolean addAll(int index, Collection<? extends E> collection)
      Add and notify any waiters that there are new elements.
      Specified by:
      addAll in interface List<E>
      Overrides:
      addAll in class Vector<E>
    • addAll

      public boolean addAll(Collection<? extends E> collection)
      Add and notify any waiters that there are new elements.
      Specified by:
      addAll in interface Collection<E>
      Specified by:
      addAll in interface List<E>
      Overrides:
      addAll in class Vector<E>
    • addElement

      public void addElement(E object)
      Add and notify any waiters that there are new elements.
      Overrides:
      addElement in class Vector<E>
    • clear

      public void clear()
      First wait until complete.
      Specified by:
      clear in interface Collection<E>
      Specified by:
      clear in interface List<E>
      Overrides:
      clear in class Vector<E>
    • clone

      public Object clone()
      First wait until complete.
      Overrides:
      clone in class Vector<E>
    • hasException

      public boolean hasException()
      Return if any exception that was throw from concurrent population thread.
    • getException

      public RuntimeException getException()
      Return any exception that was throw from concurrent population thread.
    • throwException

      public void throwException(RuntimeException exception)
      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

      public boolean contains(Object element)
      If it does not contain the object must wait until it is complete.
      Specified by:
      contains in interface Collection<E>
      Specified by:
      contains in interface List<E>
      Overrides:
      contains in class Vector<E>
    • containsAll

      public boolean containsAll(Collection<?> collection)
      If it does not contain the object must wait until it is complete.
      Specified by:
      containsAll in interface Collection<E>
      Specified by:
      containsAll in interface List<E>
      Overrides:
      containsAll in class Vector<E>
    • copyInto

      public void copyInto(Object[] array)
      First wait until complete.
      Overrides:
      copyInto in class Vector<E>
    • elementAt

      public E elementAt(int index)
      If the index is beyond the size wait until complete.
      Overrides:
      elementAt in class Vector<E>
    • getSize

      protected int getSize()
    • elements

      public Enumeration<E> elements()
      Allow concurrent streaming of the elements.
      Overrides:
      elements in class Vector<E>
    • equals

      public boolean equals(Object object)
      First wait until complete.
      Specified by:
      equals in interface Collection<E>
      Specified by:
      equals in interface List<E>
      Overrides:
      equals in class Vector<E>
    • firstElement

      public E firstElement()
      Wait until has an element or is complete.
      Overrides:
      firstElement in class Vector<E>
    • get

      public E get(int index)
      Wait until has the element or is complete.
      Specified by:
      get in interface List<E>
      Overrides:
      get in class Vector<E>
    • hashCode

      public int hashCode()
      First wait until complete.
      Specified by:
      hashCode in interface Collection<E>
      Specified by:
      hashCode in interface List<E>
      Overrides:
      hashCode in class Vector<E>
    • indexOf

      public int indexOf(Object element)
      If does not contain the object wait until complete.
      Specified by:
      indexOf in interface List<E>
      Overrides:
      indexOf in class Vector<E>
    • indexOf

      public int indexOf(Object element, int index)
      If does not contain the object wait until complete.
      Overrides:
      indexOf in class Vector<E>
    • insertElementAt

      public void insertElementAt(E element, int index)
      Add the element a notify any waiters that there are new elements.
      Overrides:
      insertElementAt in class Vector<E>
    • isEmpty

      public boolean isEmpty()
      If empty wait until an element has been added or is complete.
      Specified by:
      isEmpty in interface Collection<E>
      Specified by:
      isEmpty in interface List<E>
      Overrides:
      isEmpty in class Vector<E>
    • iterator

      public Iterator<E> iterator()
      Specified by:
      iterator in interface Collection<E>
      Specified by:
      iterator in interface Iterable<E>
      Specified by:
      iterator in interface List<E>
      Overrides:
      iterator in class Vector<E>
    • lastElement

      public E lastElement()
      First wait until complete.
      Overrides:
      lastElement in class Vector<E>
    • lastIndexOf

      public int lastIndexOf(Object element)
      First wait until complete.
      Specified by:
      lastIndexOf in interface List<E>
      Overrides:
      lastIndexOf in class Vector<E>
    • lastIndexOf

      public int lastIndexOf(Object element, int index)
      First wait until complete.
      Overrides:
      lastIndexOf in class Vector<E>
    • listIterator

      public ListIterator<E> listIterator()
      Specified by:
      listIterator in interface List<E>
      Overrides:
      listIterator in class Vector<E>
    • listIterator

      public ListIterator<E> listIterator(int index)
      Iterate while waiting at end until complete.
      Specified by:
      listIterator in interface List<E>
      Overrides:
      listIterator in class Vector<E>
    • remove

      public E remove(int index)
      If index is missing wait until is there.
      Specified by:
      remove in interface List<E>
      Overrides:
      remove in class Vector<E>
    • remove

      public boolean remove(Object element)
      If object is missing wait until complete.
      Specified by:
      remove in interface Collection<E>
      Specified by:
      remove in interface List<E>
      Overrides:
      remove in class Vector<E>
    • removeAll

      public boolean removeAll(Collection<?> collection)
      First wait until complete.
      Specified by:
      removeAll in interface Collection<E>
      Specified by:
      removeAll in interface List<E>
      Overrides:
      removeAll in class Vector<E>
    • removeAllElements

      public void removeAllElements()
      First wait until complete.
      Overrides:
      removeAllElements in class Vector<E>
    • removeElement

      public boolean removeElement(Object element)
      If missing wait until complete.
      Overrides:
      removeElement in class Vector<E>
    • removeElementAt

      public void removeElementAt(int index)
      If index is missing wait until reasched or complete.
      Overrides:
      removeElementAt in class Vector<E>
    • retainAll

      public boolean retainAll(Collection<?> collection)
      First wait until complete.
      Specified by:
      retainAll in interface Collection<E>
      Specified by:
      retainAll in interface List<E>
      Overrides:
      retainAll in class Vector<E>
    • set

      public E set(int index, E element)
      If index is missing wait until reached or complete.
      Specified by:
      set in interface List<E>
      Overrides:
      set in class Vector<E>
    • setElementAt

      public void setElementAt(E element, int index)
      If index is missing wait until reached or complete.
      Overrides:
      setElementAt in class Vector<E>
    • size

      public int size()
      First wait until complete.
      Specified by:
      size in interface Collection<E>
      Specified by:
      size in interface List<E>
      Overrides:
      size in class Vector<E>
    • subList

      public List<E> subList(int fromIndex, int toIndex)
      If index is missing wait until reached or complete.
      Specified by:
      subList in interface List<E>
      Overrides:
      subList in class Vector<E>
    • toArray

      public Object[] toArray()
      First wait until complete.
      Specified by:
      toArray in interface Collection<E>
      Specified by:
      toArray in interface List<E>
      Overrides:
      toArray in class Vector<E>
    • toArray

      public <T> T[] toArray(T[] array)
      First wait until complete.
      Specified by:
      toArray in interface Collection<E>
      Specified by:
      toArray in interface List<E>
      Overrides:
      toArray in class Vector<E>
    • toString

      public String toString()
      First wait until complete.
      Overrides:
      toString in class Vector<E>
    • trimToSize

      public void trimToSize()
      First wait until complete.
      Overrides:
      trimToSize in class Vector<E>