Class QueueIteration<E,T extends Exception>

All Implemented Interfaces:
AutoCloseable, CloseableIteration<E,T>, Iteration<E,T>
Direct Known Subclasses:
QueueCursor

@Deprecated(since="4.1.0") public abstract class QueueIteration<E,T extends Exception> extends LookAheadIteration<E,T>
Deprecated.
Makes working with a queue easier by adding the methods done() and toss(Exception) and after converting the Exception to the required type using convert(Exception).
Author:
James Leigh
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    QueueIteration(int capacity)
    Deprecated.
    Creates an QueueIteration with the given (fixed) capacity and default access policy.
    protected
    QueueIteration(int capacity, boolean fair)
    Deprecated.
    Creates an QueueIteration with the given (fixed) capacity and the specified access policy.
    protected
    QueueIteration(int capacity, boolean fair, WeakReference<?> callerRef)
    Deprecated, for removal: This API element is subject to removal in a future version.
    WeakReference is no longer supported as a way to automatically close this iteration.
    protected
    QueueIteration(int capacity, WeakReference<?> callerRef)
    Deprecated, for removal: This API element is subject to removal in a future version.
    WeakReference is no longer supported as a way to automatically close this iteration.
    protected
    Deprecated.
    Creates an QueueIteration with the given BlockingQueue as its backing queue.
    It may not be threadsafe to modify or access the given BlockingQueue from other locations.
    protected
    Deprecated, for removal: This API element is subject to removal in a future version.
    WeakReference is no longer supported as a way to automatically close this iteration.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Deprecated.
     
    protected abstract T
    Deprecated.
    Converts an exception from the underlying iteration to an exception of type X.
    void
    Deprecated.
    Indicates the method put(Object) will not be called in the queue anymore.
    Deprecated.
    Returns the next item in the queue, which may be null, or throws an exception.
    void
    Deprecated.
    Called by AbstractCloseableIteration.close() when it is called for the first time.
    void
    put(E item)
    Deprecated.
    Adds another item to the queue, blocking while the queue is full.
    void
    toss(Exception exception)
    Deprecated.
    The next time LookAheadIteration.next() is called this exception will be thrown.

    Methods inherited from class org.eclipse.rdf4j.common.iteration.LookAheadIteration

    hasNext, next, remove

    Methods inherited from class org.eclipse.rdf4j.common.iteration.AbstractCloseableIteration

    close, isClosed

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.eclipse.rdf4j.common.iteration.CloseableIteration

    stream
  • Constructor Details

    • QueueIteration

      protected QueueIteration(int capacity)
      Deprecated.
      Creates an QueueIteration with the given (fixed) capacity and default access policy.
      Parameters:
      capacity - the capacity of this queue
    • QueueIteration

      @Deprecated(since="4.1.2", forRemoval=true) protected QueueIteration(int capacity, WeakReference<?> callerRef)
      Deprecated, for removal: This API element is subject to removal in a future version.
      WeakReference is no longer supported as a way to automatically close this iteration. The recommended approach to automatically closing an iteration on garbage collection is to use a Cleaner.
      Creates an QueueIteration with the given (fixed) capacity and default access policy.
      Parameters:
      capacity - the capacity of this queue
    • QueueIteration

      @Deprecated(since="4.1.2", forRemoval=true) protected QueueIteration(int capacity, boolean fair, WeakReference<?> callerRef)
      Deprecated, for removal: This API element is subject to removal in a future version.
      WeakReference is no longer supported as a way to automatically close this iteration. The recommended approach to automatically closing an iteration on garbage collection is to use a Cleaner.
      Creates an QueueIteration with the given (fixed) capacity and the specified access policy.
      Parameters:
      capacity - the capacity of this queue
      fair - if true then queue accesses for threads blocked on insertion or removal, are processed in FIFO order; if false the access order is unspecified.
    • QueueIteration

      protected QueueIteration(int capacity, boolean fair)
      Deprecated.
      Creates an QueueIteration with the given (fixed) capacity and the specified access policy.
      Parameters:
      capacity - the capacity of this queue
      fair - if true then queue accesses for threads blocked on insertion or removal, are processed in FIFO order; if false the access order is unspecified.
    • QueueIteration

      @Deprecated(since="4.1.2", forRemoval=true) protected QueueIteration(BlockingQueue<E> queue, WeakReference<?> callerRef)
      Deprecated, for removal: This API element is subject to removal in a future version.
      WeakReference is no longer supported as a way to automatically close this iteration. The recommended approach to automatically closing an iteration on garbage collection is to use a Cleaner.
      Creates an QueueIteration with the given BlockingQueue as its backing queue.
      It may not be threadsafe to modify or access the given BlockingQueue from other locations. This method only enables the default ArrayBlockingQueue to be overridden.
      Parameters:
      queue - A BlockingQueue that is not used in other locations, but will be used as the backing Queue implementation for this cursor.
    • QueueIteration

      protected QueueIteration(BlockingQueue<E> queue)
      Deprecated.
      Creates an QueueIteration with the given BlockingQueue as its backing queue.
      It may not be threadsafe to modify or access the given BlockingQueue from other locations. This method only enables the default ArrayBlockingQueue to be overridden.
      Parameters:
      queue - A BlockingQueue that is not used in other locations, but will be used as the backing Queue implementation for this cursor.
  • Method Details

    • convert

      protected abstract T convert(Exception e)
      Deprecated.
      Converts an exception from the underlying iteration to an exception of type X.
    • toss

      public void toss(Exception exception)
      Deprecated.
      The next time LookAheadIteration.next() is called this exception will be thrown. If it is not a QueryEvaluationException or RuntimeException it will be wrapped in a QueryEvaluationException.
    • put

      public void put(E item) throws InterruptedException, T
      Deprecated.
      Adds another item to the queue, blocking while the queue is full.
      Throws:
      InterruptedException
      T extends Exception
    • done

      public void done()
      Deprecated.
      Indicates the method put(Object) will not be called in the queue anymore.
    • getNextElement

      public E getNextElement() throws T
      Deprecated.
      Returns the next item in the queue, which may be null, or throws an exception.
      Specified by:
      getNextElement in class LookAheadIteration<E,T extends Exception>
      Returns:
      The next element, or null if no more elements are available.
      Throws:
      T extends Exception
    • handleClose

      public void handleClose() throws T
      Deprecated.
      Description copied from class: AbstractCloseableIteration
      Called by AbstractCloseableIteration.close() when it is called for the first time. This method is only called once on each iteration. By default, this method does nothing.
      Overrides:
      handleClose in class LookAheadIteration<E,T extends Exception>
      Throws:
      T extends Exception
    • checkException

      public void checkException() throws T
      Deprecated.
      Throws:
      T extends Exception