com.ziclix.python.sql.util
Class Queue
- java.lang.Object
-
- com.ziclix.python.sql.util.Queue
-
public class Queue extends java.lang.ObjectThis queue blocks until closed or an element is enqueued. If the queue reaches capacity, the dequeue thread gets priority in order to bring the queue size under a certain threshold.
-
-
Constructor Summary
Constructors Constructor and Description Queue()Instantiate a blocking queue with no bounded capacity.Queue(int capacity)Instantiate a blocking queue with the specified capacity.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidclose()Close the queue and notify all waiting Threads.java.lang.Objectdequeue()Blocks until an object is dequeued or the queue is closed.voidenqueue(java.lang.Object element)Enqueue an object and notify all waiting Threads.
-
-
-
Constructor Detail
-
Queue
public Queue()
Instantiate a blocking queue with no bounded capacity.
-
Queue
public Queue(int capacity)
Instantiate a blocking queue with the specified capacity.
-
-
Method Detail
-
enqueue
public void enqueue(java.lang.Object element) throws java.lang.InterruptedExceptionEnqueue an object and notify all waiting Threads.- Throws:
java.lang.InterruptedException
-
dequeue
public java.lang.Object dequeue() throws java.lang.InterruptedExceptionBlocks until an object is dequeued or the queue is closed.- Throws:
java.lang.InterruptedException
-
close
public void close()
Close the queue and notify all waiting Threads.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG