Class QueueCursor<E>

All Implemented Interfaces:
AutoCloseable, CloseableIteration<E,QueryEvaluationException>, Iteration<E,QueryEvaluationException>
Direct Known Subclasses:
FedXQueueCursor

public class QueueCursor<E> extends QueueIteration<E,QueryEvaluationException>
Makes working with a queue easier by adding the methods QueueIteration.done() and QueueIteration.toss(Exception) and automatically converting the exception into a QueryEvaluationException with an appropriate stack trace.
Author:
James Leigh
  • Constructor Details

    • QueueCursor

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

      @Deprecated(since="4.1.2", forRemoval=true) public QueueCursor(int capacity, WeakReference<?> callerReference)
      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 QueueCursor with the given (fixed) capacity and default access policy.
      Parameters:
      capacity - the capacity of this queue
      callerReference - the thing that needs this cursor. Used to detect unexpected code failures and clean up in those case
    • QueueCursor

      @Deprecated(since="4.1.2", forRemoval=true) public QueueCursor(int capacity, boolean fair, WeakReference<?> callerReference)
      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 QueueCursor 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.
      callerReference - the thing that needs this cursor. Used to detect unexpected code failures and clean up in those case
    • QueueCursor

      @Deprecated(since="4.1.2", forRemoval=true) public QueueCursor(BlockingQueue<E> queue, WeakReference<?> callerReference)
      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 QueueCursor 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.
      callerReference - the thing that needs this cursor. Used to detect unexpected code failures and clean up in those case
    • QueueCursor

      public QueueCursor(BlockingQueue<E> queue)
      Deprecated.
      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 QueueCursor 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