public void errorComplete() { try (Locker.Lock lock = _locker.lock()) { if (DEBUG) LOG.debug("error complete {}", toStringLocked()); _async = Async.COMPLETE; _event.setDispatchContext(null); _event.setDispatchPath(null); } cancelTimeout(); }
public void dispatch(ServletContext context, String path) { boolean dispatch = false; AsyncContextEvent event; try (Locker.Lock lock = _locker.lock()) { if (DEBUG) LOG.debug("dispatch {} -> {}", toStringLocked(), path); boolean started = false; event = _event; switch (_async) { case STARTED: started = true; break; case EXPIRING: case ERRORING: case ERRORED: break; default: throw new IllegalStateException(this.getStatusStringLocked()); } _async = Async.DISPATCH; if (context != null) _event.setDispatchContext(context); if (path != null) _event.setDispatchPath(path); if (started) { switch (_state) { case DISPATCHED: case ASYNC_IO: case ASYNC_WOKEN: break; case ASYNC_WAIT: _state = State.ASYNC_WOKEN; dispatch = true; break; default: LOG.warn("async dispatched when complete {}", this); break; } } } cancelTimeout(event); if (dispatch) scheduleDispatch(); }