org.directwebremoting.impl
Class BaseSleeper

java.lang.Object
  extended by org.directwebremoting.impl.BaseSleeper
All Implemented Interfaces:
java.io.Serializable, Sleeper
Direct Known Subclasses:
JettyContinuationSleeper, Servlet30Sleeper, ThreadWaitSleeper

public abstract class BaseSleeper
extends java.lang.Object
implements Sleeper

Common functionality for stock Sleepers.

Author:
Mike Wilson
See Also:
Serialized Form

Constructor Summary
BaseSleeper(javax.servlet.http.HttpServletResponse response, RealScriptSession scriptSession, ScriptConduit conduit)
           
 
Method Summary
 void enterSleep(java.lang.Runnable onClose, int disconnectedTime)
          'halt' the current execution in some way.
 void wakeUpForData()
          Wake up to handle new data that arrived in the associated ScriptSession.
 int wakeUpToClose()
          Wake up to close down the Sleeper and free any resources held by it.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseSleeper

public BaseSleeper(javax.servlet.http.HttpServletResponse response,
                   RealScriptSession scriptSession,
                   ScriptConduit conduit)
            throws java.io.IOException
Throws:
java.io.IOException
Method Detail

enterSleep

public final void enterSleep(java.lang.Runnable onClose,
                             int disconnectedTime)
                      throws java.io.IOException
Description copied from interface: Sleeper
'halt' the current execution in some way. This method should be the last meaningful thing that is done in a poll request to activate the Sleeper's background wait mechanism.

Specified by:
enterSleep in interface Sleeper
Parameters:
onClose - The action to take when Sleeper.wakeUpToClose() is called
disconnectedTime - The waiting time to instruct the browser before the next poll
Throws:
java.io.IOException

wakeUpForData

public final void wakeUpForData()
Description copied from interface: Sleeper
Wake up to handle new data that arrived in the associated ScriptSession.

Specified by:
wakeUpForData in interface Sleeper

wakeUpToClose

public final int wakeUpToClose()
Description copied from interface: Sleeper
Wake up to close down the Sleeper and free any resources held by it. The previously supplied onClose callback will be executed.

Specified by:
wakeUpToClose in interface Sleeper
Returns:
the disconnectedTime that will be sent to the client

Copyright ยจ 2008