Top Description Fields Constructors Methods
com.ziclix.python.sql.util

public Class Queue

extends Object
Class Inheritance
Imports
java.util.LinkedList

This 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.
Author
brian zimmer

Field Summary

Modifier and TypeField and Description
protected int
capacity

Field capacity, threshold

protected boolean
closed

Field closed

protected LinkedList<Object>
queue

Field queue

protected int
threshold

Field capacity, threshold

Constructor Summary

AccessConstructor and Description
public
Queue()

Instantiate a blocking queue with no bounded capacity.

public
Queue(int capacity)

Instantiate a blocking queue with the specified capacity.

Method Summary

Modifier and TypeMethod and Description
public synchronized void
close()

Close the queue and notify all waiting Threads.

public synchronized Object
dequeue()

Blocks until an object is dequeued or the queue is closed.

public synchronized void
enqueue(Object element)

Enqueue an object and notify all waiting Threads.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

capacityback to summary
protected int capacity

Field capacity, threshold

closedback to summary
protected boolean closed

Field closed

queueback to summary
protected LinkedList<Object> queue

Field queue

thresholdback to summary
protected int threshold

Field capacity, threshold

Constructor Detail

Queueback to summary
public Queue()

Instantiate a blocking queue with no bounded capacity.

Queueback to summary
public Queue(int capacity)

Instantiate a blocking queue with the specified capacity.

Method Detail

closeback to summary
public synchronized void close()

Close the queue and notify all waiting Threads.

dequeueback to summary
public synchronized Object dequeue() throws InterruptedException

Blocks until an object is dequeued or the queue is closed.

enqueueback to summary
public synchronized void enqueue(Object element) throws InterruptedException

Enqueue an object and notify all waiting Threads.