diff options
Diffstat (limited to 'jetty-server/src/main/java/org/eclipse/jetty/server/HttpOutput.java')
-rw-r--r-- | jetty-server/src/main/java/org/eclipse/jetty/server/HttpOutput.java | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpOutput.java b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpOutput.java index ea69d416f3..926a7a6b83 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpOutput.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpOutput.java @@ -82,7 +82,7 @@ public class HttpOutput extends ServletOutputStream implements Runnable setWriteListener() READY->owp ise ise ise ise ise write() OPEN ise PENDING wpe wpe eof flush() OPEN ise PENDING wpe wpe eof - close() CLOSED CLOSED CLOSED CLOSED wpe CLOSED + close() CLOSED CLOSED CLOSED CLOSED CLOSED CLOSED isReady() OPEN:true READY:true READY:true UNREADY:false UNREADY:false CLOSED:true write completed - - - ASYNC READY->owp - */ @@ -195,11 +195,17 @@ public class HttpOutput extends ServletOutputStream implements Runnable { return; } + + case ASYNC: case UNREADY: + case PENDING: { - if (_state.compareAndSet(state,OutputState.ERROR)) - _writeListener.onError(_onError==null?new EofException("Async close"):_onError); - break; + if (!_state.compareAndSet(state,OutputState.CLOSED)) + break; + IOException ex = new IOException("Closed while Pending/Unready"); + LOG.warn(ex.toString()); + LOG.debug(ex); + _channel.abort(ex); } default: { @@ -286,6 +292,20 @@ public class HttpOutput extends ServletOutputStream implements Runnable return _state.get()==OutputState.CLOSED; } + public boolean isAsync() + { + switch(_state.get()) + { + case ASYNC: + case READY: + case PENDING: + case UNREADY: + return true; + default: + return false; + } + } + @Override public void flush() throws IOException { @@ -307,6 +327,8 @@ public class HttpOutput extends ServletOutputStream implements Runnable return; case PENDING: + return; + case UNREADY: throw new WritePendingException(); @@ -1255,4 +1277,5 @@ public class HttpOutput extends ServletOutputStream implements Runnable super.onCompleteFailure(x); } } + } |