public class LinkedBlockingMultiQueue.SubQueue extends AbstractOfferable<E>
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Atomically removes all of the elements from this queue.
|
boolean |
contains(java.lang.Object o) |
void |
enable(boolean status)
Enable or disable this sub-queue.
|
boolean |
isEmpty()
Return whether the queue is empty.
|
boolean |
isEnabled()
Returns whether this sub-queue is enabled
|
java.util.Iterator<E> |
iterator()
Returns an iterator over the elements in this queue in proper sequence.
|
boolean |
offer(E e)
Inserts the specified element into this queue if it is possible to do so immediately without violating capacity
restrictions.
|
boolean |
offer(E e,
long timeout,
java.util.concurrent.TimeUnit unit)
Inserts the specified element into this queue, waiting up to the specified wait time if necessary for space to
become available.
|
void |
put(E e)
Inserts the specified element into this queue, waiting if necessary for space to become available.
|
int |
remainingCapacity()
Returns the number of additional elements that this queue can ideally (in the absence of memory or resource
constraints) accept without blocking, or
Integer.MAX_VALUE if there is no intrinsic limit. |
boolean |
remove(java.lang.Object o) |
int |
size()
Return the number of elements in this sub queue.
|
java.lang.Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
java.lang.String |
toString() |
add, addAllclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic int remainingCapacity()
OfferableInteger.MAX_VALUE if there is no intrinsic limit.
Note that you cannot always tell if an attempt to insert an element will succeed by inspecting
remainingCapacity because it may be the case that another thread is about to insert or remove an element.
public void clear()
public void enable(boolean status)
status - true to enable, false to disablepublic boolean isEnabled()
public int size()
public boolean isEmpty()
public void put(E e) throws java.lang.InterruptedException
Offerablee - the element to addjava.lang.InterruptedException - if interrupted while waitingpublic boolean offer(E e, long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
Offerablee - the element to addtimeout - how long to wait before giving up, in units of unitunit - a TimeUnit determining how to interpret the timeout parametertrue if successful, or false if the specified waiting time elapses before space is
availablejava.lang.InterruptedException - if interrupted while waitingpublic boolean offer(E e)
OfferableOfferable.add(E), which
can fail to insert an element only by throwing an exception.e - the element to addtrue if the element was added to this queue, else falsepublic boolean remove(java.lang.Object o)
public boolean contains(java.lang.Object o)
public java.lang.String toString()
toString in class java.util.AbstractCollection<E>public java.lang.Object[] toArray()
public <T> T[] toArray(T[] a)
public java.util.Iterator<E> iterator()
The returned iterator is weakly consistent.