Merge remote-tracking branch 'origin/jetty-9.3.x'
This commit is contained in:
commit
0e16f46173
|
@ -51,7 +51,7 @@ public class AsyncContextState implements AsyncContext
|
|||
{
|
||||
HttpChannelState state=_state;
|
||||
if (state==null)
|
||||
throw new IllegalStateException("AsyncContext completed");
|
||||
throw new IllegalStateException("AsyncContext completed and/or Request lifecycle recycled");
|
||||
return state;
|
||||
}
|
||||
|
||||
|
|
|
@ -87,6 +87,7 @@ public class HttpChannelState
|
|||
*/
|
||||
public enum Async
|
||||
{
|
||||
NOT_ASYNC,
|
||||
STARTED, // AsyncContext.startAsync() has been called
|
||||
DISPATCH, // AsyncContext.dispatch() has been called
|
||||
COMPLETE, // AsyncContext.complete() has been called
|
||||
|
@ -114,7 +115,7 @@ public class HttpChannelState
|
|||
{
|
||||
_channel=channel;
|
||||
_state=State.IDLE;
|
||||
_async=null;
|
||||
_async=Async.NOT_ASYNC;
|
||||
_initial=true;
|
||||
}
|
||||
|
||||
|
@ -228,32 +229,29 @@ public class HttpChannelState
|
|||
return Action.WRITE_CALLBACK;
|
||||
}
|
||||
|
||||
if (_async!=null)
|
||||
{
|
||||
Async async=_async;
|
||||
switch(async)
|
||||
switch(_async)
|
||||
{
|
||||
case COMPLETE:
|
||||
_state=State.COMPLETING;
|
||||
return Action.COMPLETE;
|
||||
case DISPATCH:
|
||||
_state=State.DISPATCHED;
|
||||
_async=null;
|
||||
_async=Async.NOT_ASYNC;
|
||||
return Action.ASYNC_DISPATCH;
|
||||
case EXPIRED:
|
||||
case ERRORED:
|
||||
_state=State.DISPATCHED;
|
||||
_async=null;
|
||||
_async=Async.NOT_ASYNC;
|
||||
return Action.ERROR_DISPATCH;
|
||||
case STARTED:
|
||||
case EXPIRING:
|
||||
case ERRORING:
|
||||
return Action.WAIT;
|
||||
|
||||
case NOT_ASYNC:
|
||||
break;
|
||||
default:
|
||||
throw new IllegalStateException(getStatusStringLocked());
|
||||
}
|
||||
}
|
||||
|
||||
return Action.WAIT;
|
||||
|
||||
|
@ -276,8 +274,7 @@ public class HttpChannelState
|
|||
{
|
||||
if(DEBUG)
|
||||
LOG.debug("startAsync {}",toStringLocked());
|
||||
|
||||
if (_state!=State.DISPATCHED || _async!=null)
|
||||
if (_state!=State.DISPATCHED || _async!=Async.NOT_ASYNC)
|
||||
throw new IllegalStateException(this.getStatusStringLocked());
|
||||
|
||||
_async=Async.STARTED;
|
||||
|
@ -354,20 +351,18 @@ public class HttpChannelState
|
|||
throw new IllegalStateException(this.getStatusStringLocked());
|
||||
}
|
||||
|
||||
if (_async!=null)
|
||||
{
|
||||
_initial=false;
|
||||
switch(_async)
|
||||
{
|
||||
case COMPLETE:
|
||||
_state=State.COMPLETING;
|
||||
_async=null;
|
||||
_async=Async.NOT_ASYNC;
|
||||
action=Action.COMPLETE;
|
||||
break;
|
||||
|
||||
case DISPATCH:
|
||||
_state=State.DISPATCHED;
|
||||
_async=null;
|
||||
_async=Async.NOT_ASYNC;
|
||||
action=Action.ASYNC_DISPATCH;
|
||||
break;
|
||||
|
||||
|
@ -403,24 +398,25 @@ public class HttpChannelState
|
|||
// onTimeout handling is complete, but did not dispatch as
|
||||
// we were handling. So do the error dispatch here
|
||||
_state=State.DISPATCHED;
|
||||
_async=null;
|
||||
_async=Async.NOT_ASYNC;
|
||||
action=Action.ERROR_DISPATCH;
|
||||
break;
|
||||
|
||||
case ERRORED:
|
||||
_state=State.DISPATCHED;
|
||||
_async=null;
|
||||
_async=Async.NOT_ASYNC;
|
||||
action=Action.ERROR_DISPATCH;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new IllegalStateException(this.getStatusStringLocked());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
case NOT_ASYNC:
|
||||
_state=State.COMPLETING;
|
||||
action=Action.COMPLETE;
|
||||
break;
|
||||
|
||||
default:
|
||||
_state=State.COMPLETING;
|
||||
action=Action.COMPLETE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -690,7 +686,7 @@ public class HttpChannelState
|
|||
}
|
||||
|
||||
// Are we blocking?
|
||||
if (_async==null)
|
||||
if (_async==Async.NOT_ASYNC)
|
||||
{
|
||||
// Only called from within HttpChannel Handling, so much be dispatched, let's stay dispatched!
|
||||
if (_state==State.DISPATCHED)
|
||||
|
@ -792,7 +788,7 @@ public class HttpChannelState
|
|||
aListeners=_asyncListeners;
|
||||
event=_event;
|
||||
_state=State.COMPLETED;
|
||||
_async=null;
|
||||
_async=Async.NOT_ASYNC;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -855,7 +851,7 @@ public class HttpChannelState
|
|||
}
|
||||
_asyncListeners=null;
|
||||
_state=State.IDLE;
|
||||
_async=null;
|
||||
_async=Async.NOT_ASYNC;
|
||||
_initial=true;
|
||||
_asyncReadPossible=_asyncReadUnready=false;
|
||||
_asyncWrite=false;
|
||||
|
@ -882,7 +878,7 @@ public class HttpChannelState
|
|||
}
|
||||
_asyncListeners=null;
|
||||
_state=State.UPGRADED;
|
||||
_async=null;
|
||||
_async=Async.NOT_ASYNC;
|
||||
_initial=true;
|
||||
_asyncReadPossible=_asyncReadUnready=false;
|
||||
_asyncWrite=false;
|
||||
|
@ -972,7 +968,7 @@ public class HttpChannelState
|
|||
try(Locker.Lock lock= _locker.lock())
|
||||
{
|
||||
if (_state==State.DISPATCHED)
|
||||
return _async!=null;
|
||||
return _async!=Async.NOT_ASYNC;
|
||||
return _async==Async.STARTED || _async==Async.EXPIRING;
|
||||
}
|
||||
}
|
||||
|
@ -981,7 +977,7 @@ public class HttpChannelState
|
|||
{
|
||||
try(Locker.Lock lock= _locker.lock())
|
||||
{
|
||||
return !_initial || _async!=null;
|
||||
return !_initial || _async!=Async.NOT_ASYNC;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue