org.norther.tammi.acorn.util.concurrent
Class NonBlockingQueue
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractQueue
org.norther.tammi.acorn.util.concurrent.NonBlockingQueue
- All Implemented Interfaces:
- Serializable, Iterable, Collection, BlockingQueue, Queue
public class NonBlockingQueue
- extends AbstractQueue
- implements BlockingQueue, Serializable
An array-based none-blocking queue class without any concurrency control. All
methods are synchronized and those that should block throw
IllegalStateException instead.
- Author:
- Ilkka Priha
- See Also:
- Serialized Form
|
Constructor Summary |
NonBlockingQueue(int capacity)
Creates a queue with the specified capacity. |
| Methods inherited from interface java.util.Collection |
addAll, clear, contains, containsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, toArray, toArray |
NonBlockingQueue
public NonBlockingQueue(int capacity)
- Creates a queue with the specified capacity.
- Parameters:
capacity - the capacity.
offer
public boolean offer(Object o)
- Specified by:
offer in interface BlockingQueue- Specified by:
offer in interface Queue
offer
public boolean offer(Object o,
long timeout,
TimeUnit unit)
- Specified by:
offer in interface BlockingQueue
peek
public Object peek()
- Specified by:
peek in interface Queue
poll
public Object poll()
- Specified by:
poll in interface Queue
poll
public Object poll(long timeout,
TimeUnit unit)
- Specified by:
poll in interface BlockingQueue
size
public int size()
- Specified by:
size in interface Collection- Specified by:
size in class AbstractCollection
drainTo
public int drainTo(Collection c)
- Specified by:
drainTo in interface BlockingQueue
drainTo
public int drainTo(Collection c,
int max)
- Specified by:
drainTo in interface BlockingQueue
remainingCapacity
public int remainingCapacity()
- Specified by:
remainingCapacity in interface BlockingQueue
put
public void put(Object o)
throws InterruptedException
- Specified by:
put in interface BlockingQueue
- Throws:
InterruptedException
take
public Object take()
throws InterruptedException
- Specified by:
take in interface BlockingQueue
- Throws:
InterruptedException
iterator
public Iterator iterator()
- Specified by:
iterator in interface Iterable- Specified by:
iterator in interface Collection- Specified by:
iterator in class AbstractCollection
capacity
public int capacity()
- Returns the capacity of the buffer.
- Returns:
- the capacity.
Copyright © 2004 The Norther Organization. All rights reserved.