Package jadex.collection
Interface IBlockingQueue<T>
- All Known Implementing Classes:
ArrayBlockingQueue
,BlockingQueue
public interface IBlockingQueue<T>
A queue that blocks until an element is available.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic class
Closed exception. -
Method Summary
Modifier and TypeMethodDescriptiondequeue()
Dequeue an element.dequeue
(long timeout) Dequeue an element.void
Enqueue an element.boolean
isClosed()
Check if the queue is closed.peek()
Peek the topmost element without dequeuing it.setClosed
(boolean closed) Open/close the queue.int
size()
Get the size.
-
Method Details
-
enqueue
Enqueue an element.- Parameters:
element
- The element.- Throws:
IBlockingQueue.ClosedException
-
dequeue
Dequeue an element.- Returns:
- The element. When queue is empty the methods blocks until an element is added.
- Throws:
IBlockingQueue.ClosedException
-
peek
Peek the topmost element without dequeuing it.- Returns:
- The element. When queue is empty the methods blocks until an element is added.
- Throws:
IBlockingQueue.ClosedException
-
dequeue
Dequeue an element.- Parameters:
timeout
- the time to wait (in millis) or -1 for no timeout.- Returns:
- The element. When queue is empty the methods blocks until an element is added or the timeout occurs.
- Throws:
IBlockingQueue.ClosedException
TimeoutException
-
setClosed
Open/close the queue.- Parameters:
closed
- The closed state.- Returns:
- The remaining elements after the queue has been closed.
-
isClosed
boolean isClosed()Check if the queue is closed. -
size
int size()Get the size.- Returns:
- The size.
-