public class ObjectQueue
extends java.lang.Object
Constructor and Description |
---|
ObjectQueue() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Signals the closing of this queue, interrupting any running
take() method calls. |
int |
getSize()
Returns the number of objects currently in the queue.
|
boolean |
isEmpty() |
java.lang.Object |
poll(int a_msTimeout)
Tries returning an object using
pop() . |
java.lang.Object |
pop()
Returns the least recent object in the queue.
|
void |
push(java.lang.Object a_object)
Pushes an object to the head of the queue.
|
java.lang.Object |
take()
If the queue is empty this method blocks until a new item is available
or the queue has been closed using
close() . |
public int getSize()
public void close()
take()
method calls.
Note: This doesn't affect any other method calls and gets undone, when pushing an object into the queue.
public void push(java.lang.Object a_object)
a_object
- public java.lang.Object pop()
public java.lang.Object take()
close()
.public java.lang.Object poll(int a_msTimeout) throws java.lang.InterruptedException
pop()
. If no object was
available it waits a_msTimeout
milliseconds and calls
pop()
, returning the result.a_msTimeout
- Amount of milliseconds to wait, if queue is empty.pop()
. null, if null was returned.java.lang.InterruptedException
public boolean isEmpty()
Copyright © 2023. All rights reserved.