public class ConcurrentLinkedBlockingQueue2<T>
extends java.util.concurrent.ConcurrentLinkedQueue<T>
implements java.util.concurrent.BlockingQueue<T>
Modifier and Type | Field and Description |
---|---|
protected int |
capacity |
protected java.util.concurrent.atomic.AtomicInteger |
count |
protected java.util.concurrent.locks.Condition |
not_empty |
protected java.util.concurrent.locks.Lock |
not_empty_lock |
Constructor and Description |
---|
ConcurrentLinkedBlockingQueue2(int capacity) |
Modifier and Type | Method and Description |
---|---|
protected void |
decrCount() |
int |
drainTo(java.util.Collection<? super T> c) |
int |
drainTo(java.util.Collection<? super T> c,
int maxElements) |
protected void |
incrCount() |
boolean |
offer(T t)
Drops elements if capacity has been reached.
|
boolean |
offer(T t,
long timeout,
java.util.concurrent.TimeUnit unit) |
T |
poll() |
T |
poll(long timeout,
java.util.concurrent.TimeUnit unit) |
void |
put(T t) |
int |
remainingCapacity() |
boolean |
remove(java.lang.Object o) |
int |
size() |
T |
take() |
protected void |
waitForNotEmpty() |
add, addAll, contains, isEmpty, iterator, peek, spliterator, toArray, toArray
containsAll, removeAll, retainAll, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
protected final int capacity
protected final java.util.concurrent.atomic.AtomicInteger count
protected final java.util.concurrent.locks.Lock not_empty_lock
protected final java.util.concurrent.locks.Condition not_empty
public ConcurrentLinkedBlockingQueue2(int capacity)
public boolean offer(T t)
public T take() throws java.lang.InterruptedException
take
in interface java.util.concurrent.BlockingQueue<T>
java.lang.InterruptedException
public T poll()
public T poll(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
poll
in interface java.util.concurrent.BlockingQueue<T>
java.lang.InterruptedException
public boolean remove(java.lang.Object o)
public int remainingCapacity()
remainingCapacity
in interface java.util.concurrent.BlockingQueue<T>
public int drainTo(java.util.Collection<? super T> c)
drainTo
in interface java.util.concurrent.BlockingQueue<T>
public void put(T t) throws java.lang.InterruptedException
put
in interface java.util.concurrent.BlockingQueue<T>
java.lang.InterruptedException
public boolean offer(T t, long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
offer
in interface java.util.concurrent.BlockingQueue<T>
java.lang.InterruptedException
public int size()
public int drainTo(java.util.Collection<? super T> c, int maxElements)
drainTo
in interface java.util.concurrent.BlockingQueue<T>
protected void waitForNotEmpty() throws java.lang.InterruptedException
java.lang.InterruptedException
protected void decrCount()
protected void incrCount()
Copyright © 1998-2020 Red Hat. All Rights Reserved.