org.directwebremoting.extend
Interface Sleeper

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
GrizzlyContinuationSleeper, JettyContinuationSleeper, Servlet3Sleeper, ThreadWaitSleeper, TomcatSleeper

public interface Sleeper
extends java.io.Serializable

A Sleeper allows the request to halt and cease execution for some time, while still allowing output.

There are 3 envisaged implementations

All implementations of Sleeper must be Serializable so we can store Sleepers in the session and therefore have other connections wake them up.

Author:
Joe Walker [joe at getahead dot ltd dot uk]

Method Summary
 void goToSleep(java.lang.Runnable onAwakening)
          'halt' the current execution in some way.
 void wakeUp()
          This method should attempt to resume the execution.
 

Method Detail

goToSleep

void goToSleep(java.lang.Runnable onAwakening)
'halt' the current execution in some way. This method should be the last meaningful thing that is done on a request, and work that needs to be done before completion should be done in a Runnable so the system can schedule it at an appropriate time.

Parameters:
onAwakening - The action to take when wakeUp() is called

wakeUp

void wakeUp()
This method should attempt to resume the execution. It is possible that this method will be called more than once at the same time so Sleepers should be prepared take steps to be woken only once.


Copyright 2008