Package com.ericsson.otp.erlang
Class GenericQueue
- java.lang.Object
-
- com.ericsson.otp.erlang.GenericQueue
-
public class GenericQueue extends java.lang.ObjectThis class implements a generic FIFO queue. There is no upper bound on the length of the queue, items are linked.
-
-
Constructor Summary
Constructors Constructor Description GenericQueue()Create an empty queue
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidflush()Clear a queuejava.lang.Objectget()Retrieve an object from the head of the queue, or block until one arrives.java.lang.Objectget(long timeout)Retrieve an object from the head of the queue, blocking until one arrives or until timeout occurs.intgetCount()voidput(java.lang.Object o)Add an object to the tail of the queue.java.lang.ObjecttryGet()
-
-
-
Method Detail
-
flush
public void flush()
Clear a queue
-
close
public void close()
-
put
public void put(java.lang.Object o)
Add an object to the tail of the queue.- Parameters:
o- Object to insert in the queue
-
get
public java.lang.Object get()
Retrieve an object from the head of the queue, or block until one arrives.- Returns:
- The object at the head of the queue.
-
get
public java.lang.Object get(long timeout) throws java.lang.InterruptedExceptionRetrieve an object from the head of the queue, blocking until one arrives or until timeout occurs.- Parameters:
timeout- Maximum time to block on queue, in ms. Use 0 to poll the queue.- Returns:
- The object at the head of the queue, or null if none arrived in time.
- Throws:
java.lang.InterruptedException- if the operation times out.
-
tryGet
public java.lang.Object tryGet()
-
getCount
public int getCount()
-
-