orc.orchard
Class ThreadWaiter

java.lang.Object
  extended by orc.orchard.ThreadWaiter
All Implemented Interfaces:
Waiter

public class ThreadWaiter
extends java.lang.Object
implements Waiter

Use Java wait/notify to implement suspend/resume.

Author:
quark
See Also:
Waiter

Constructor Summary
ThreadWaiter()
           
 
Method Summary
 void resume()
          Signal that the asynchronous call should be resumed.
 void suspend(java.lang.Object monitor)
          Suspend the current request and release locks.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreadWaiter

public ThreadWaiter()
Method Detail

suspend

public void suspend(java.lang.Object monitor)
             throws java.lang.InterruptedException
Description copied from interface: Waiter
Suspend the current request and release locks. When the request is resumed, any of the following may happen: Therefore the request must be reentrant.

Specified by:
suspend in interface Waiter
Parameters:
monitor - the monitor to wait on if a blocking implementation is used.
Throws:
java.lang.InterruptedException - if the call timed out.

resume

public void resume()
Description copied from interface: Waiter
Signal that the asynchronous call should be resumed. This may mean that a waiting call to suspend() returns, or that the asynchronous call is simply retried.

Specified by:
resume in interface Waiter