public class InMemoryQueue extends AbstractHookQueue
started
Constructor and Description |
---|
InMemoryQueue()
Default constructor
|
InMemoryQueue(java.util.concurrent.BlockingQueue<HookRequest> queue)
Create the InMemoryQueue with the given Queue object
|
InMemoryQueue(WhoasQueueConfig queueConfig)
Create the InMemoryQueue from configuration
|
Modifier and Type | Method and Description |
---|---|
int |
getSize()
Return the number of elements in the queue
|
void |
pop(QueueAction action)
Performs a blocking pop on the queue and invokes the closure with the
item popped from the queue
If the Closure throws an exception, the dequeued item will be returned
to the tail end of the queue
|
java.lang.Boolean |
push(HookRequest request)
Attempt to insert the request into the queue
If the request cannot be inserted, this method will return false,
otherwise true.
|
start, stop
public InMemoryQueue(WhoasQueueConfig queueConfig)
queueConfig
- not usedpublic InMemoryQueue()
public InMemoryQueue(java.util.concurrent.BlockingQueue<HookRequest> queue)
queue
- aubclass of BlockingQueue
which we will use instead of the default internal memory queuepublic int getSize()
getSize
in class AbstractHookQueue
public void pop(QueueAction action) throws java.lang.InterruptedException, java.lang.Exception
pop
in class AbstractHookQueue
action
- a QueueAction
to invokejava.lang.Exception
- the underlying QueueAction
may throw any form of exceptionjava.lang.InterruptedException
public java.lang.Boolean push(HookRequest request)
push
in class AbstractHookQueue
request
- A valid HookRequest
HookRequest
was successfully added to the queue