Package org.eclipse.jetty.toolchain.test
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 Condition
static final boolean
private static final long
private int
private final ReentrantLock
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
void
awaitEventCount
(int expectedEventCount, int timeoutDuration, TimeUnit timeoutUnit) Await a specific event countprivate void
private boolean
boolean
void
shutdown()
Shutdown the queue.Methods inherited from class java.util.concurrent.LinkedBlockingQueue
clear, contains, drainTo, drainTo, forEach, iterator, offer, peek, poll, poll, put, remainingCapacity, remove, removeAll, removeIf, retainAll, size, spliterator, take, toArray, toArray, toString
Methods inherited from class java.util.AbstractQueue
addAll, element, remove
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.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:
add
in interfaceBlockingQueue<E>
- Specified by:
add
in interfaceCollection<E>
- Specified by:
add
in interfaceQueue<E>
- Overrides:
add
in 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:
offer
in interfaceBlockingQueue<E>
- Specified by:
offer
in interfaceQueue<E>
- Overrides:
offer
in classLinkedBlockingQueue<E>
-
shutdown
public void shutdown()Shutdown the queue.
-