net.sf.asyncobjects.util
Class RequestQueue

java.lang.Object
  extended by net.sf.asyncobjects.util.RequestQueue

public class RequestQueue
extends Object

This utiliy class represent request queue. This class should be never exposed to clients outside of component. The class has also sleep / awake functionality that is used to suspend current operation until some external condition is fullfilled (for example in BytePipe pipe's ByteInput waits until someone writes to ByteOuput using this method). Note that it is not recommeded to use this class direclty to demarkate requests. Use Serialized utility class instead.

See Also:
Serialized

Constructor Summary
RequestQueue()
           
 
Method Summary
 void awake()
          this method awake latest request if there is some need to do so
 Promise<Void> awaken()
          Sleep until explicitly resumed.
 void endRequest()
          End current required
 Promise<Void> startRequest()
          start performing request, usually this method is called after noPending or ready.
 boolean tryStartRequest()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RequestQueue

public RequestQueue()
Method Detail

tryStartRequest

public boolean tryStartRequest()
Returns:
true, if current request could be performed immediatly

startRequest

public Promise<Void> startRequest()
start performing request, usually this method is called after noPending or ready.

Returns:
a promise that resolves when next request is allowed to start

endRequest

public void endRequest()
End current required


awaken

public Promise<Void> awaken()
Sleep until explicitly resumed.

Returns:
promise that is resolved when some awake method will be called, usually it is called in head of some when construct.

awake

public void awake()
this method awake latest request if there is some need to do so



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