Package org.eclipse.rdf4j.query.impl
Class QueueCursor<E>
- java.lang.Object
-
- org.eclipse.rdf4j.common.iteration.AbstractCloseableIteration<E,X>
-
- org.eclipse.rdf4j.common.iteration.LookAheadIteration<E,T>
-
- org.eclipse.rdf4j.common.iteration.QueueIteration<E,QueryEvaluationException>
-
- org.eclipse.rdf4j.query.impl.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 methodsQueueIteration.done()andQueueIteration.toss(Exception)and automatically converting the exception into a QueryEvaluationException with an appropriate stack trace.- Author:
- James Leigh
-
-
Constructor Summary
Constructors Constructor Description QueueCursor(int capacity, boolean fair, WeakReference<?> callerReference)Creates an QueueCursor with the given (fixed) capacity and the specified access policy.QueueCursor(int capacity, WeakReference<?> callerReference)Creates an QueueCursor with the given (fixed) capacity and default access policy.QueueCursor(BlockingQueue<E> queue, WeakReference<?> callerReference)Creates an QueueCursor with the givenBlockingQueueas its backing queue.
It may not be threadsafe to modify or access the givenBlockingQueuefrom other locations.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected QueryEvaluationExceptionconvert(Exception e)Converts an exception from the underlying iteration to an exception of type X.-
Methods inherited from class org.eclipse.rdf4j.common.iteration.QueueIteration
checkException, done, getNextElement, handleClose, put, toss
-
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
-
-
-
-
Constructor Detail
-
QueueCursor
public QueueCursor(int capacity, WeakReference<?> callerReference)Creates an QueueCursor with the given (fixed) capacity and default access policy.- Parameters:
capacity- the capacity of this queuecallerReference- the thing that needs this cursor. Used to detect unexpected code failures and clean up in those case
-
QueueCursor
public QueueCursor(int capacity, boolean fair, WeakReference<?> callerReference)Creates an QueueCursor with the given (fixed) capacity and the specified access policy.- Parameters:
capacity- the capacity of this queuefair- 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
public QueueCursor(BlockingQueue<E> queue, WeakReference<?> callerReference)
Creates an QueueCursor with the givenBlockingQueueas its backing queue.
It may not be threadsafe to modify or access the givenBlockingQueuefrom other locations. This method only enables the defaultArrayBlockingQueueto 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
-
-
Method Detail
-
convert
protected QueryEvaluationException convert(Exception e)
Description copied from class:QueueIterationConverts an exception from the underlying iteration to an exception of type X.- Specified by:
convertin classQueueIteration<E,QueryEvaluationException>
-
-