org.apache.coyote

## Class AsyncStateMachine<S>

- java.lang.Object
- - org.apache.coyote.AsyncStateMachine<S>

-     public class AsyncStateMachine<S>
      extends java.lang.Object

  Manages the state transitions for async requests.

       The internal states that are used are:
       DISPATCHED    - Standard request. Not in Async mode.
       STARTING      - ServletRequest.startAsync() has been called but the
                       request in which that call was made has not finished
                       processing.
       STARTED       - ServletRequest.startAsync() has been called and the
                       request in which that call was made has finished
                       processing.
       MUST_COMPLETE - complete() has been called before the request in which
                       ServletRequest.startAsync() has finished. As soon as that
                       request finishes, the complete() will be processed.
       COMPLETING    - The call to complete() was made once the request was in
                       the STARTED state. May or may not be triggered by a
                       container thread - depends if start(Runnable) was used
       TIMING_OUT    - The async request has timed out and is waiting for a call
                       to complete(). If that isn't made, the error state will
                       entered.
       MUST_DISPATCH - dispatch() has been called from a container thread. The
                       dispatch will be processed once processing control returns to
                       the container.
       DISPATCHING   - dispatch() has been called from a non-container thread. The
                       dispatch will be processed as soon as a container thread is
                       available.
       ERROR         - Something went wrong.

       |----------------->--------------|
       |                               \|/
       |   |----------<---------------ERROR
       |   |      complete()         /|\ | \
       |   |                          |  |  \---------------|
       |   |                          |  |                  |dispatch()
       |   |                          |  |postProcess()    \|/
       |   |                   error()|  |                  |
       |   |                          |  |  |--|timeout()   |
       |   |           postProcess()  | \|/ | \|/           |         auto
       |   |         |--------------->DISPATCHED<---------- | --------------COMPLETING<-----|
       |   |         |               /|\  |                 |                 | /|\         |
       |   |         |    |--->-------|   |                 |                 |--|          |
       |   |         ^    |               |startAsync()     |               timeout()       |
       |   |         |    |               |                 |                               |
       |  \|/        |    |  complete()  \|/  postProcess() |                               |
       | MUST_COMPLETE-<- | ----<------STARTING-->--------- | ------------|                 ^
       |         /|\      |               |                 |             |      complete() |
       |          |       |               |                 |             |     /-----------|
       |          |       ^               |dispatch()       |             |    /
       |          |       |               |                 |             |   /
       |          |       |              \|/                |            \|/ /
       |          |       |----<----MUST_DISPATCH----<------|          STARTED
       |          |       |   auto              \                      /|
       |          |       |                      \                    / |
       ^          ^       ^                       \        dispatch()/  |
       |          |       |                        \                /   |
       |          |       |               |-------- \ -------------/    |auto
       |          |       |               |          \                  |
       |          |       |               |           \                 |
       |          |       | auto         \|/           \               \|/
       |          |       |---<------DISPATCHING        \---------TIMING_OUT
       |          |                                   dispatch()    |   |
       |          |                                                 |   |
       |          |-------<----------------------------------<------|   |
       |                              complete()                        |
       |                                                                |
       |<--------<-------------------<-------------------------------<--|
                                       error()

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AsyncStateMachine(Processor<S> processor)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `asyncComplete()`
    `boolean` | `asyncDispatch()`
    `void` | `asyncDispatched()`
    `boolean` | `asyncError()`
    `AbstractEndpoint.Handler.SocketState` | `asyncPostProcess()`
    `void` | `asyncRun(java.lang.Runnable runnable)`
    `void` | `asyncStart(AsyncContextCallback asyncCtxt)`
    `boolean` | `asyncTimeout()`
    `boolean` | `isAsync()`
    `boolean` | `isAsyncDispatching()`
    `boolean` | `isAsyncError()`
    `boolean` | `isAsyncStarted()`
    `boolean` | `isAsyncTimingOut()`
    `boolean` | `isCompleting()`
    `void` | `recycle()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AsyncStateMachine

          public AsyncStateMachine(Processor<S> processor)

  - ### Method Detail

    - #### isAsync

          public boolean isAsync()

    - #### isAsyncDispatching

          public boolean isAsyncDispatching()

    - #### isAsyncStarted

          public boolean isAsyncStarted()

    - #### isAsyncTimingOut

          public boolean isAsyncTimingOut()

    - #### isAsyncError

          public boolean isAsyncError()

    - #### isCompleting

          public boolean isCompleting()

    - #### asyncStart

          public void asyncStart(AsyncContextCallback asyncCtxt)

    - #### asyncPostProcess

          public AbstractEndpoint.Handler.SocketState asyncPostProcess()

    - #### asyncComplete

          public boolean asyncComplete()

    - #### asyncTimeout

          public boolean asyncTimeout()

    - #### asyncDispatch

          public boolean asyncDispatch()

    - #### asyncDispatched

          public void asyncDispatched()

    - #### asyncError

          public boolean asyncError()

    - #### asyncRun

          public void asyncRun(java.lang.Runnable runnable)

    - #### recycle

          public void recycle()

Copyright © 2000-2015 Apache Software Foundation. All Rights Reserved.