net.sf.asyncobjects.util
Class Queue<T>

java.lang.Object
  extended by net.sf.asyncobjects.AsyncUnicastServer<AQueue<T>>
      extended by net.sf.asyncobjects.util.Queue<T>
Type Parameters:
T - Element type of the queue
All Implemented Interfaces:
AsyncObject, ExplicitSharing, AQueue<T>

public class Queue<T>
extends AsyncUnicastServer<AQueue<T>>
implements AQueue<T>

Object queue. Note that this class is not threadsafe and it should be used only in context of single vat. The class is a a service that supports AQueue interface. However it could be used directly without exporting it.


Constructor Summary
Queue()
          A constructor
Queue(int maxWaiters, int maxValues)
          A constructor
 
Method Summary
 Promise<T> get()
          Get object from the queue
 Promise<Void> put(T o)
          Put object from the queue
 void smash(Throwable t)
          Smash all pending waiters in the queue
 
Methods inherited from class net.sf.asyncobjects.AsyncUnicastServer
dereference, export, isImmediate, myVat, promise
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.sf.asyncobjects.AsyncObject
dereference, isImmediate
 

Constructor Detail

Queue

public Queue(int maxWaiters,
             int maxValues)
A constructor

Parameters:
maxWaiters - maximum amount of waiters, -1 means unilmited
maxValues - maximum amount of values pending in the queue, -1 means unilmited

Queue

public Queue()
A constructor

Method Detail

get

public Promise<T> get()
Description copied from interface: AQueue
Get object from the queue

Specified by:
get in interface AQueue<T>
Returns:
got object
See Also:
AQueue.get()

put

public Promise<Void> put(T o)
Description copied from interface: AQueue
Put object from the queue

Specified by:
put in interface AQueue<T>
Parameters:
o - an object to put
Returns:
a promise that resolves to nul lwhen object is accpeted in the queue
See Also:
AQueue.put(java.lang.Object)

smash

public void smash(Throwable t)
Smash all pending waiters in the queue

Parameters:
t - a problem to smash pending waiters with


Copyright © 2002-2007 Constantine Plotnikov. All Rights Reserved.