public class SynchronizedStack<E> extends Object implements Serializable
BlockingDeque.
This is for use in AsyncObjectPool and should be faster than LinkedBlockingDeque in size checks and
dequeuing on an empty Q which is expected in a busy pool.| Constructor and Description |
|---|
SynchronizedStack(int capacity)
Creates a Synchronized Stack.
|
| Modifier and Type | Method and Description |
|---|---|
int |
drainTo(Collection<? super E> c) |
int |
drainTo(Collection<? super E> c,
int maxElements) |
int |
getCapacity()
Gets max capacity of this stack was created with which is the length of the underlying array.
|
boolean |
offerFirst(E item) |
E |
pollFirst() |
boolean |
setCapacity(int newCapacity)
Sets the capacity of the stack to the new value if the current count is not greater than the new capacity.
|
int |
size() |
public SynchronizedStack(int capacity)
capacity - Max elements in the stackpublic boolean offerFirst(E item)
BlockingDeque.offerFirst(Object)public E pollFirst()
Deque.pollFirst()public int drainTo(Collection<? super E> c, int maxElements)
public int drainTo(Collection<? super E> c)
BlockingQueue.drainTo(Collection)public int size()
BlockingDeque.size()public int getCapacity()
public boolean setCapacity(int newCapacity)
newCapacity - New CapacityCopyright © 2013- Suresh Mahalingam. All Rights Reserved.