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:
java.io.Serializable
,java.lang.Iterable<E>
,java.util.Collection<E>
,java.util.concurrent.BlockingQueue<E>
,java.util.Queue<E>
public class EventQueue<E> extends java.util.concurrent.LinkedBlockingQueue<E>
Event Queue for capturing potential events within a testing scenario.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.locks.Condition
countReached
static boolean
DEBUG
private static long
DEBUG_START
private int
goalCount
private java.util.concurrent.locks.ReentrantLock
lock
-
Constructor Summary
Constructors Constructor Description EventQueue()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(E o)
void
awaitEventCount(int expectedEventCount, int timeoutDuration, java.util.concurrent.TimeUnit timeoutUnit)
Await a specific event countprivate void
debug(java.lang.String format, java.lang.Object... args)
private boolean
goalCheck()
boolean
offer(E o)
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.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
-
-
-
Field Detail
-
DEBUG
public static final boolean DEBUG
- See Also:
- Constant Field Values
-
DEBUG_START
private static final long DEBUG_START
-
lock
private final java.util.concurrent.locks.ReentrantLock lock
-
countReached
private final java.util.concurrent.locks.Condition countReached
-
goalCount
private int goalCount
-
-
Method Detail
-
add
public boolean add(E o)
-
awaitEventCount
public void awaitEventCount(int expectedEventCount, int timeoutDuration, java.util.concurrent.TimeUnit timeoutUnit) throws java.util.concurrent.TimeoutException, java.lang.InterruptedException
Await a specific event count- Parameters:
expectedEventCount
- the number of events to wait fortimeoutDuration
- the timeout durationtimeoutUnit
- the timeout unit- Throws:
java.util.concurrent.TimeoutException
- if timeout while waiting for the event countjava.lang.InterruptedException
- if await was interrupted
-
debug
private void debug(java.lang.String format, java.lang.Object... args)
-
goalCheck
private boolean goalCheck()
-
offer
public boolean offer(E o)
-
shutdown
public void shutdown()
Shutdown the queue.
-
-