Class EventQueue<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractQueue<E>
java.util.concurrent.LinkedBlockingQueue<E>
org.eclipse.jetty.toolchain.test.EventQueue<E>
- Type Parameters:
E- the type of entry in this EventQueue
- All Implemented Interfaces:
Serializable, Iterable<E>, Collection<E>, BlockingQueue<E>, Queue<E>
Event Queue for capturing potential events within a testing scenario.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Conditionstatic final booleanprivate static final longprivate intprivate final ReentrantLock -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanvoidawaitEventCount(int expectedEventCount, int timeoutDuration, TimeUnit timeoutUnit) Await a specific event countprivate voidprivate booleanbooleanvoidshutdown()Shutdown the queue.Methods inherited from class LinkedBlockingQueue
clear, contains, drainTo, drainTo, forEach, iterator, offer, peek, poll, poll, put, remainingCapacity, remove, removeAll, removeIf, retainAll, size, spliterator, take, toArray, toArray, toStringMethods inherited from class AbstractQueue
addAll, element, removeMethods inherited from class AbstractCollection
containsAll, isEmptyMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Collection
addAll, containsAll, equals, hashCode, isEmpty, parallelStream, stream, toArray
-
Field Details
-
DEBUG
public static final boolean DEBUG- See Also:
-
DEBUG_START
private static final long DEBUG_START -
lock
-
countReached
-
goalCount
private int goalCount
-
-
Constructor Details
-
EventQueue
public EventQueue()
-
-
Method Details
-
add
- Specified by:
addin interfaceBlockingQueue<E>- Specified by:
addin interfaceCollection<E>- Specified by:
addin interfaceQueue<E>- Overrides:
addin classAbstractQueue<E>
-
awaitEventCount
public void awaitEventCount(int expectedEventCount, int timeoutDuration, TimeUnit timeoutUnit) throws TimeoutException, InterruptedException Await a specific event count- Parameters:
expectedEventCount- the number of events to wait fortimeoutDuration- the timeout durationtimeoutUnit- the timeout unit- Throws:
TimeoutException- if timeout while waiting for the event countInterruptedException- if await was interrupted
-
debug
-
goalCheck
private boolean goalCheck() -
offer
- Specified by:
offerin interfaceBlockingQueue<E>- Specified by:
offerin interfaceQueue<E>- Overrides:
offerin classLinkedBlockingQueue<E>
-
shutdown
public void shutdown()Shutdown the queue.
-