diff src/org/eclipse/jetty/server/BlockingHttpConnection.java @ 1035:898774c2cd87

remove HttpGenerator.returnBuffers()
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 03 Nov 2016 21:09:57 -0600
parents 4ada7a8c128a
children
line wrap: on
line diff
--- a/src/org/eclipse/jetty/server/BlockingHttpConnection.java	Thu Nov 03 21:02:59 2016 -0600
+++ b/src/org/eclipse/jetty/server/BlockingHttpConnection.java	Thu Nov 03 21:09:57 2016 -0600
@@ -44,68 +44,61 @@
 	@Override
 	public void handle() throws IOException
 	{
-		try
+		// do while the endpoint is open
+		// AND the connection has not changed
+		while (_endp.isOpen())
 		{
-			// do while the endpoint is open
-			// AND the connection has not changed
-			while (_endp.isOpen())
+			try
 			{
-				try
-				{
-					// If we are not ended then parse available
-					if (!_parser.isComplete() && !_endp.isInputShutdown())
-						_parser.parseAvailable();
+				// If we are not ended then parse available
+				if (!_parser.isComplete() && !_endp.isInputShutdown())
+					_parser.parseAvailable();
+
+				// Do we have more generating to do?
+				// Loop here because some writes may take multiple steps and
+				// we need to flush them all before potentially blocking in the
+				// next loop.
+				if (_generator.isCommitted() && !_generator.isComplete() && !_endp.isOutputShutdown())
+					_generator.flushBuffer();
 
-					// Do we have more generating to do?
-					// Loop here because some writes may take multiple steps and
-					// we need to flush them all before potentially blocking in the
-					// next loop.
-					if (_generator.isCommitted() && !_generator.isComplete() && !_endp.isOutputShutdown())
-						_generator.flushBuffer();
+				// Flush buffers
+				_endp.flush();
+			}
+			catch (HttpException e)
+			{
+				if (LOG.isDebugEnabled())
+				{
+					LOG.debug("uri="+_uri);
+					LOG.debug("fields="+_requestFields);
+					LOG.debug("",e);
+				}
+				_generator.sendError(e.getStatus(), e.getReason(), null, true);
+				initParser();
+				_endp.shutdownOutput();
+			}
+			finally
+			{
+				//  Is this request/response round complete and are fully flushed?
+				if (_parser.isComplete() && _generator.isComplete())
+				{
+					// Reset the parser/generator
+					reset();
 
-					// Flush buffers
-					_endp.flush();
-				}
-				catch (HttpException e)
-				{
-					if (LOG.isDebugEnabled())
+					// TODO Is this required?
+					if (!_generator.isPersistent() && !_endp.isOutputShutdown())
 					{
-						LOG.debug("uri="+_uri);
-						LOG.debug("fields="+_requestFields);
-						LOG.debug("",e);
+						LOG.warn("Safety net oshut!!! Please open a bugzilla");
+						_endp.shutdownOutput();
 					}
-					_generator.sendError(e.getStatus(), e.getReason(), null, true);
-					initParser();
-					_endp.shutdownOutput();
 				}
-				finally
+				
+				// If we don't have a committed response and we are not suspended
+				if (_endp.isInputShutdown() && _generator.isIdle())
 				{
-					//  Is this request/response round complete and are fully flushed?
-					if (_parser.isComplete() && _generator.isComplete())
-					{
-						// Reset the parser/generator
-						reset();
-
-						// TODO Is this required?
-						if (!_generator.isPersistent() && !_endp.isOutputShutdown())
-						{
-							LOG.warn("Safety net oshut!!! Please open a bugzilla");
-							_endp.shutdownOutput();
-						}
-					}
-					
-					// If we don't have a committed response and we are not suspended
-					if (_endp.isInputShutdown() && _generator.isIdle())
-					{
-						// then no more can happen, so close.
-						_endp.close();
-					}
+					// then no more can happen, so close.
+					_endp.close();
 				}
 			}
 		}
-		finally
-		{
-			_generator.returnBuffers();
-		}
 	}
 }