The Queue
class is a very simple queue assuming that there is
at least one consumer and potentially multiple producers. This class poses
no restrictions on the size of the queue.
@Deprecated public class Queue extends Object
Constructor and Description |
---|
Queue()
Deprecated.
Creates an instance of this queue.
|
Modifier and Type | Method and Description |
---|---|
Object |
get(long timeout)
Deprecated.
Returns the first element from the queue.
|
void |
put(Object object)
Deprecated.
Appends the given
object to the end of the queue. |
public void put(Object object)
object
to the end of the queue.
After appending the element, the queue is notified such that threads waiting to retrieve an element from the queue are woken up.
object
- the object to be addedpublic Object get(long timeout) throws InterruptedException
timeout
- The maximum number of milliseconds to wait for an entry in
the queue if the queue is empty. If zero, the method waits forever
for an element.null
if the method
timed out waiting for an entry.InterruptedException
- Is thrown if the current thread is
interrupted while waiting for the queue to get at least one entry.Copyright © 2004–2024 The Apache Software Foundation. All rights reserved.