com.sun.grizzly.connectioncache.spi.concurrent
Interface ConcurrentQueue<V>

All Known Implementing Classes:
ConcurrentQueueBlockingImpl, ConcurrentQueueImpl, ConcurrentQueueNonBlockingImpl

public interface ConcurrentQueue<V>

A class that provides a very simply unbounded queue. The main requirement here is that the class support constant time (very fast) deletion of arbitrary elements. An instance of this class must be thread safe, either by locking or by using a wait-free algorithm (preferred). The interface is made as simple is possible to make it easier to produce a wait-free implementation.


Nested Class Summary
static interface ConcurrentQueue.Handle<V>
          A Handle provides the capability to delete an element of a ConcurrentQueue very quickly.
 
Method Summary
 ConcurrentQueue.Handle<V> offer(V arg)
          Add a new element to the tail of the queue.
 V poll()
          Return an element from the head of the queue.
 int size()
          Return the number of elements in the queue.
 

Method Detail

size

int size()
Return the number of elements in the queue.

Returns:
number of elements in the queue

offer

ConcurrentQueue.Handle<V> offer(V arg)
Add a new element to the tail of the queue. Returns a handle for the element in the queue.

Parameters:
arg - element to add to the queue
Returns:
a ConcurrentQueue.Handle for the element added to the queue

poll

V poll()
Return an element from the head of the queue. The element is removed from the queue.

Returns:
element removed from the queue


Copyright © 2012 Oracle Corporation. All Rights Reserved.