aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Becker2013-06-11 10:16:57 (EDT)
committerThomas Becker2013-06-11 10:17:15 (EDT)
commitbeba00c5e02c74f4555e1cc348488d3ef7183636 (patch)
tree4600039b77c683ce01b6e29839b6ae93c3d3fd3c
parentc5bdc019a2b7bfedd606b9531b4cd0aad66291e9 (diff)
downloadorg.eclipse.jetty.project-beba00c5e02c74f4555e1cc348488d3ef7183636.zip
org.eclipse.jetty.project-beba00c5e02c74f4555e1cc348488d3ef7183636.tar.gz
org.eclipse.jetty.project-beba00c5e02c74f4555e1cc348488d3ef7183636.tar.bz2
410337 HttpOutput calls now HttpChannel.close() instead of closing the endPoint directly. That way the different implementations of HttpChannel can decide if the endPoint should be shutdown or not.
-rw-r--r--jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java9
-rw-r--r--jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java6
-rw-r--r--jetty-server/src/main/java/org/eclipse/jetty/server/HttpOutput.java6
3 files changed, 17 insertions, 4 deletions
diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java
index 1d29941..e9f61ac 100644
--- a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java
+++ b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java
@@ -672,7 +672,6 @@ public class HttpChannel<T> implements HttpParser.RequestHandler<T>, Runnable
* @param content the content buffer to write
* @param complete whether the content is complete for the response
* @param callback Callback when complete or failed
- * @throws IOException if the write fails
*/
protected void write(ByteBuffer content, boolean complete, Callback callback)
{
@@ -698,6 +697,14 @@ public class HttpChannel<T> implements HttpParser.RequestHandler<T>, Runnable
return getEndPoint() instanceof ChannelEndPoint;
}
+ /**
+ * If a write or similar to this channel fails this method should be called. The standard implementation
+ * of {@link #failed()} is a noop. But the different implementations of HttpChannel might want to take actions.
+ */
+ public void failed()
+ {
+ }
+
private class CommitCallback implements Callback
{
private final Callback _callback;
diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java
index e5186cd..ab6dc4e 100644
--- a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java
+++ b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java
@@ -578,6 +578,12 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
_generator.setPersistent(false);
super.handleException(x);
}
+
+ @Override
+ public void failed()
+ {
+ getEndPoint().shutdownOutput();
+ }
}
private class CommitCallback extends IteratingCallback
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 4f6c588..62c93ac 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
@@ -99,7 +99,7 @@ public class HttpOutput extends ServletOutputStream
}
catch(IOException e)
{
- _channel.getEndPoint().shutdownOutput();
+ _channel.failed();
LOG.ignore(e);
}
releaseBuffer();
@@ -120,7 +120,7 @@ public class HttpOutput extends ServletOutputStream
}
catch(IOException e)
{
- _channel.getEndPoint().shutdownOutput();
+ _channel.failed();
LOG.ignore(e);
}
}
@@ -168,7 +168,7 @@ public class HttpOutput extends ServletOutputStream
public void write(byte[] b, int off, int len) throws IOException
{
if (isClosed())
- throw new EOFException("Closed");
+ throw new EOFException("Closed:" + System.identityHashCode(this));
_written+=len;
boolean complete=_channel.getResponse().isAllContentWritten(_written);