The internal states that are used are:
DISPATCHED - Standard request. Not in Async mode.
STARTING - ServletRequest.startAsync() has been called from
Servlet.service() but service() has not exited.
STARTED - ServletRequest.startAsync() has been called from
Servlet.service() and service() has exited.
READ_WRITE_OP - Performing an asynchronous read or write.
MUST_COMPLETE - ServletRequest.startAsync() followed by complete() have
been called during a single Servlet.service() method. The
complete() will be processed as soon as Servlet.service()
exits.
COMPLETE_PENDING - ServletRequest.startAsync() has been called from
Servlet.service() but, before service() exited, complete()
was called from another thread. The complete() will
be processed as soon as Servlet.service() exits.
COMPLETING - The call to complete() was made once the request was in
the STARTED state.
TIMING_OUT - The async request has timed out and is waiting for a call
to complete() or dispatch(). If that isn't made, the error
state will be entered.
MUST_DISPATCH - ServletRequest.startAsync() followed by dispatch() have
been called during a single Servlet.service() method. The
dispatch() will be processed as soon as Servlet.service()
exits.
DISPATCH_PENDING - ServletRequest.startAsync() has been called from
Servlet.service() but, before service() exited, dispatch()
was called from another thread. The dispatch() will
be processed as soon as Servlet.service() exits.
DISPATCHING - The dispatch is being processed.
MUST_ERROR - ServletRequest.startAsync() has been called from
Servlet.service() but, before service() exited, an I/O
error occurred on another thread. The container will
perform the necessary error handling when
Servlet.service() exits.
ERROR - Something went wrong.
The valid state transitions are:
post() dispatched()
|-------»------------------»---------| |-------«-----------------------«-----|
| | | |
| | | post() |
| post() \|/ \|/ dispatched() |
| |-----»----------------»DISPATCHED«-------------«-------------| |
| | | /|\ | | |
| | startAsync()| |--|timeout() | |
^ | | | |
| | complete() | dispatch() ^ |
| | |--«---------------«-- | ---«--MUST_ERROR--»-----| | |
| | | | /|\ | | |
| ^ | | | | | |
| | | | /-----|error() | | |
| | | | / | ^ |
| | \|/ ST-complete() \|/ / ST-dispatch() \|/ | |
| MUST_COMPLETE«--------«--------STARTING--------»---------»MUST_DISPATCH |
| / | \ |
| / | \ |
| OT-complete() / | \ OT-dispatch() |
| COMPLETE_PENDING«------«------/ | \-------»---------»DISPATCH_PENDING |
| | /|\ | /|\ | |
| | | | | |post() |
| | |OT-complete() | OT-dispatch()| | |
| | |---------«-------«---|---«--\ | | |
| | | \ | | |
| | /-------«-------«-- | --«---READ_WRITE--»----| | |
| | / ST-complete() | / /|\ \ | |
| | / | post()/ / \ | |
| | / | / / \ | |
| | / | / / \ | |
| | / | / / \ | |
| | / | | / \ | |
| | / | | / ST-dispatch()\ | |
| | | | | | \ | |
| post()| | timeout() post()| | |asyncOperation() \ | timeout() |
| | | |--| | | | | | |--| |
| \|/\|/\|/ | complete() \|/ \|/| dispatch() \|/\|/ \|/ | |
|--«-----COMPLETING«--------«----------STARTED--------»---------»DISPATCHING----|
/|\ /|\ | /|\ | /|\ /|\
| | | |--| | |
| | timeout()| post() | |
| | | | |
| | complete() \|/ dispatch() | |
| |------------«-------TIMING_OUT--------»----------------| |
| |
| complete() dispatch() |
|---------------«-----------ERROR--------------»-----------------|
Notes: * For clarity, the transitions to ERROR which are valid from every state apart from
STARTING are not shown.
* All transitions may happen on either the Servlet.service() thread (ST) or on any
other thread (OT) unless explicitly marked.
| Modifier and Type | Class and Description |
|---|---|
| private static enum |
| Modifier and Type | Field and Description |
|---|---|
| private AsyncContextCallback | |
| private final AtomicLong | |
| private boolean | |
| private volatile long | |
| private static final Log | |
| private final AbstractProcessor | |
| private static final StringManager | |
| private volatile AsyncStateMachine. |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv synchronized boolean | |
| pack-priv synchronized boolean | |
| pack-priv synchronized void | |
| pack-priv synchronized boolean | |
| pack-priv synchronized void | |
| pack-priv synchronized AbstractEndpoint. | |
| pack-priv synchronized void | |
| pack-priv synchronized void | |
| pack-priv synchronized boolean | |
| private void | |
| pack-priv long | |
| pack-priv long | Returns: The time (as returned bySystem#currentTimeMillis()) that this connection last transitioned to
asyncObtain the time that this connection last transitioned to async processing. |
| pack-priv boolean | |
| pack-priv boolean | |
| pack-priv boolean | |
| pack-priv boolean | |
| pack-priv boolean | |
| pack-priv synchronized boolean | |
| pack-priv boolean | |
| pack-priv synchronized void | |
| private synchronized void |
| asyncCtxt | back to summary |
|---|---|
| private AsyncContextCallback asyncCtxt | |
| generation | back to summary |
|---|---|
| private final AtomicLong generation | |
| hasProcessedError | back to summary |
|---|---|
| private boolean hasProcessedError | |
| lastAsyncStart | back to summary |
|---|---|
| private volatile long lastAsyncStart | |
| log | back to summary |
|---|---|
| private static final Log log | |
| processor | back to summary |
|---|---|
| private final AbstractProcessor processor | |
| sm | back to summary |
|---|---|
| private static final StringManager sm | |
| state | back to summary |
|---|---|
| private volatile AsyncStateMachine. | |
| AsyncStateMachine | back to summary |
|---|---|
| pack-priv AsyncStateMachine(AbstractProcessor processor) | |
| asyncComplete | back to summary |
|---|---|
| pack-priv synchronized boolean asyncComplete() | |
| asyncDispatch | back to summary |
|---|---|
| pack-priv synchronized boolean asyncDispatch() | |
| asyncDispatched | back to summary |
|---|---|
| pack-priv synchronized void asyncDispatched() | |
| asyncError | back to summary |
|---|---|
| pack-priv synchronized boolean asyncError() | |
| asyncOperation | back to summary |
|---|---|
| pack-priv synchronized void asyncOperation() | |
| asyncPostProcess | back to summary |
|---|---|
| pack-priv synchronized AbstractEndpoint. | |
| asyncRun | back to summary |
|---|---|
| pack-priv synchronized void asyncRun(Runnable runnable) | |
| asyncStart | back to summary |
|---|---|
| pack-priv synchronized void asyncStart(AsyncContextCallback asyncCtxt) | |
| asyncTimeout | back to summary |
|---|---|
| pack-priv synchronized boolean asyncTimeout() | |
| clearNonBlockingListeners | back to summary |
|---|---|
| private void clearNonBlockingListeners() | |
| getCurrentGeneration | back to summary |
|---|---|
| pack-priv long getCurrentGeneration() | |
| getLastAsyncStart | back to summary |
|---|---|
| pack-priv long getLastAsyncStart() Obtain the time that this connection last transitioned to async processing.
| |
| isAsync | back to summary |
|---|---|
| pack-priv boolean isAsync() | |
| isAsyncDispatching | back to summary |
|---|---|
| pack-priv boolean isAsyncDispatching() | |
| isAsyncError | back to summary |
|---|---|
| pack-priv boolean isAsyncError() | |
| isAsyncStarted | back to summary |
|---|---|
| pack-priv boolean isAsyncStarted() | |
| isAsyncTimingOut | back to summary |
|---|---|
| pack-priv boolean isAsyncTimingOut() | |
| isAvailable | back to summary |
|---|---|
| pack-priv synchronized boolean isAvailable() | |
| isCompleting | back to summary |
|---|---|
| pack-priv boolean isCompleting() | |
| recycle | back to summary |
|---|---|
| pack-priv synchronized void recycle() | |
| updateState | back to summary |
|---|---|
| private synchronized void updateState(AsyncStateMachine. | |
| Modifier and Type | Field and Description |
|---|---|
| public static final AsyncStateMachine. | |
| public static final AsyncStateMachine. | |
| public static final AsyncStateMachine. | |
| public static final AsyncStateMachine. | |
| public static final AsyncStateMachine. | |
| public static final AsyncStateMachine. | |
| private final boolean | |
| private final boolean | |
| private final boolean | |
| private final boolean | |
| public static final AsyncStateMachine. | |
| public static final AsyncStateMachine. | |
| public static final AsyncStateMachine. | |
| public static final AsyncStateMachine. | |
| public static final AsyncStateMachine. | |
| public static final AsyncStateMachine. | |
| public static final AsyncStateMachine. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv boolean | |
| pack-priv boolean | |
| pack-priv boolean | |
| pack-priv boolean | |
| public static AsyncStateMachine. | |
| public static AsyncStateMachine. |
| COMPLETE_PENDING | back to summary |
|---|---|
| public static final AsyncStateMachine. | |
| COMPLETING | back to summary |
|---|---|
| public static final AsyncStateMachine. | |
| DISPATCH_PENDING | back to summary |
|---|---|
| public static final AsyncStateMachine. | |
| DISPATCHED | back to summary |
|---|---|
| public static final AsyncStateMachine. | |
| DISPATCHING | back to summary |
|---|---|
| public static final AsyncStateMachine. | |
| ERROR | back to summary |
|---|---|
| public static final AsyncStateMachine. | |
| isAsync | back to summary |
|---|---|
| private final boolean isAsync | |
| isCompleting | back to summary |
|---|---|
| private final boolean isCompleting | |
| isDispatching | back to summary |
|---|---|
| private final boolean isDispatching | |
| isStarted | back to summary |
|---|---|
| private final boolean isStarted | |
| MUST_COMPLETE | back to summary |
|---|---|
| public static final AsyncStateMachine. | |
| MUST_DISPATCH | back to summary |
|---|---|
| public static final AsyncStateMachine. | |
| MUST_ERROR | back to summary |
|---|---|
| public static final AsyncStateMachine. | |
| READ_WRITE_OP | back to summary |
|---|---|
| public static final AsyncStateMachine. | |
| STARTED | back to summary |
|---|---|
| public static final AsyncStateMachine. | |
| STARTING | back to summary |
|---|---|
| public static final AsyncStateMachine. | |
| TIMING_OUT | back to summary |
|---|---|
| public static final AsyncStateMachine. | |
| AsyncState | back to summary |
|---|---|
| private AsyncState(boolean isAsync, boolean isStarted, boolean isCompleting, boolean isDispatching) | |
| isAsync | back to summary |
|---|---|
| pack-priv boolean isAsync() | |
| isCompleting | back to summary |
|---|---|
| pack-priv boolean isCompleting() | |
| isDispatching | back to summary |
|---|---|
| pack-priv boolean isDispatching() | |
| isStarted | back to summary |
|---|---|
| pack-priv boolean isStarted() | |
| valueOf | back to summary |
|---|---|
| public static AsyncStateMachine. | |
| values | back to summary |
|---|---|
| public static AsyncStateMachine. | |