| |
|
| org.mortbay.util.ajax.Continuation
All known Subclasses: org.mortbay.util.ajax.WaitingContinuation,
Continuation | public interface Continuation (Code) | | Continuation.
A continuation is a mechanism by which a HTTP Request can be
suspended and restarted after a timeout or an asynchronous event
has occured.
Blocking continuations will block the process of the request during a
call to
Continuation.suspend(long) .
Non-blocking continuation can abort the current request and arrange for it
to be retried when
Continuation.resume() is called or the timeout expires.
In order to supprt non-blocking continuations, it is important that
all actions taken by a filter or servlet before a call to
Continuation.suspend(long) are either idempotent (can be retried) or
are made conditional on
Continuation.isPending so they are not performed on
retried requests.
With the appropriate HTTP Connector, this allows threadless waiting
for events (see
org.mortbay.jetty.nio.SelectChannelConnector ).
author: gregw |
Method Summary | |
public Object | getObject() Arbitrary object associated with the continuation for context. | public boolean | isNew() Is this a newly created Continuation. | public boolean | isPending() Get the pending status?
A continuation is pending while the handling of a call to suspend has not completed. | public boolean | isResumed() | public void | reset() Reset the continuation. | public void | resume() Resume the request.
Resume a suspended request. | public void | setObject(Object o) Arbitrary object associated with the continuation for context. | public boolean | suspend(long timeout) Suspend handling.
This method will suspend the request for the timeout or until resume is
called.
timeout. |
getObject | public Object getObject()(Code) | | Arbitrary object associated with the continuation for context.
An arbitrary object associated with the continuation |
isNew | public boolean isNew()(Code) | | Is this a newly created Continuation.
A newly created continuation has not had
Continuation.getEvent(long) called on it.
True if the continuation has just been created and has not yet suspended the request. |
isPending | public boolean isPending()(Code) | | Get the pending status?
A continuation is pending while the handling of a call to suspend has not completed.
For blocking continuations, pending is true only during the call to
Continuation.suspend(long) .
For non-blocking continuations, pending is true until a second call to
Continuation.suspend(long) ,
thus this method can be used to determine if a request is being retried.
True if the continuation is handling a call to suspend. |
isResumed | public boolean isResumed()(Code) | | Get the resumed status?
True if the continuation is has been resumed. |
reset | public void reset()(Code) | | Reset the continuation.
Cancel any pending status of the continuation.
|
resume | public void resume()(Code) | | Resume the request.
Resume a suspended request. The passed event will be returned in the getObject method.
|
setObject | public void setObject(Object o)(Code) | | Arbitrary object associated with the continuation for context.
Parameters: o - An arbitrary object to associate with the continuation |
suspend | public boolean suspend(long timeout)(Code) | | Suspend handling.
This method will suspend the request for the timeout or until resume is
called.
timeout. A timeout of < 0 will cause an immediate return. I timeout of 0 will wait indefinitely. True if resume called or false if timeout. |
|
|
|