Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Wilkins2013-08-09 04:42:10 +0000
committerGreg Wilkins2013-08-09 04:42:10 +0000
commit3e79877bccea57bff7f501aafea4a9665db1b6a4 (patch)
tree8481c20ba5255cf11e07453559e4125718066baf /jetty-server
parentdbbc43edb194d6a33b5efcab8efc63f912732651 (diff)
downloadorg.eclipse.jetty.project-3e79877bccea57bff7f501aafea4a9665db1b6a4.tar.gz
org.eclipse.jetty.project-3e79877bccea57bff7f501aafea4a9665db1b6a4.tar.xz
org.eclipse.jetty.project-3e79877bccea57bff7f501aafea4a9665db1b6a4.zip
414727 Ensure asynchronously flushed resources are closed
Diffstat (limited to 'jetty-server')
-rw-r--r--jetty-server/src/main/java/org/eclipse/jetty/server/HttpOutput.java24
1 files changed, 22 insertions, 2 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 f52d92b4c0..147eca478f 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
@@ -373,7 +373,8 @@ public class HttpOutput extends ServletOutputStream
/* ------------------------------------------------------------ */
/** Asynchronous send of content.
- * @param in The content to send
+ * @param in The content to send as a stream. The stream will be closed
+ * after reading all content.
* @param callback The callback to use to notify success or failure
*/
public void sendContent(InputStream in, Callback callback)
@@ -383,7 +384,8 @@ public class HttpOutput extends ServletOutputStream
/* ------------------------------------------------------------ */
/** Asynchronous send of content.
- * @param in The content to send
+ * @param in The content to send as a channel. The channel will be closed
+ * after reading all content.
* @param callback The callback to use to notify success or failure
*/
public void sendContent(ReadableByteChannel in, Callback callback)
@@ -479,6 +481,7 @@ public class HttpOutput extends ServletOutputStream
{
eof=true;
len=0;
+ _in.close();
}
else if (len<_buffer.capacity())
{
@@ -511,6 +514,14 @@ public class HttpOutput extends ServletOutputStream
{
super.failed(x);
_channel.getByteBufferPool().release(_buffer);
+ try
+ {
+ _in.close();
+ }
+ catch (IOException e)
+ {
+ LOG.ignore(e);
+ }
}
}
@@ -547,6 +558,7 @@ public class HttpOutput extends ServletOutputStream
{
eof=true;
len=0;
+ _in.close();
}
else if (len<_buffer.capacity())
{
@@ -578,6 +590,14 @@ public class HttpOutput extends ServletOutputStream
{
super.failed(x);
_channel.getByteBufferPool().release(_buffer);
+ try
+ {
+ _in.close();
+ }
+ catch (IOException e)
+ {
+ LOG.ignore(e);
+ }
}
}
}

Back to the top