com.sun.grizzly.arp
Interface AsyncFilter
- All Known Implementing Classes:
- CometAsyncFilter, WebSocketAsyncFilter
public interface AsyncFilter
An interface marker used to execute operations before
a AsyncProcesssorTask
in pre/post or interrupted. Usually,
implementation of this interface is called by an instance of
AsyncExecutor
.
Using an AsyncExecutor
, it is possible to suspend or resume
the current request processing. Once suspended, the request can always
be resumed using the AsyncExecutor
, and the normal Grizzly
invocation path will be used (like calling Adapter#service
or GrizzlyAdapter#service
).
To invoke the GrizzlyAdapter
from an AsyncFilter, just invoke
AsyncExecutor.execute()
, and then calling AsyncExecutor.postExecute()
will commit the response.
Implementation of this interface must be thread-safe.
- Author:
- Jeanfrancois Arcand
doFilter
AsyncFilter.Result doFilter(AsyncExecutor asyncExecutor)
- Execute and return
AsyncFilter.Result
.
AsyncFilter.Result.NEXT
: next AsyncFilter should be executed;
AsyncFilter.Result.INTERRUPT
: interrupts the execution, filter is becoming responsible for finishing the processing;
AsyncFilter.Result.FINISH
: finish the async execution (skip the rest of the filters).
- Returns:
AsyncFilter.Result
Copyright © 2012 Oracle Corporation. All Rights Reserved.