diff src/org/eclipse/jetty/server/BlockingHttpConnection.java @ 874:ad495e897c32

minor
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 04 Oct 2016 13:34:23 -0600
parents 8e9db0bbf4f9
children fe461f7cfc8e
line wrap: on
line diff
--- a/src/org/eclipse/jetty/server/BlockingHttpConnection.java	Mon Oct 03 20:03:50 2016 -0600
+++ b/src/org/eclipse/jetty/server/BlockingHttpConnection.java	Tue Oct 04 13:34:23 2016 -0600
@@ -35,104 +35,104 @@
  */
 public class BlockingHttpConnection extends AbstractHttpConnection
 {
-    private static final Logger LOG = LoggerFactory.getLogger(BlockingHttpConnection.class);
+	private static final Logger LOG = LoggerFactory.getLogger(BlockingHttpConnection.class);
 
-    public BlockingHttpConnection(Connector connector, EndPoint endpoint, Server server)
-    {
-        super(connector,endpoint,server);
-    }
+	public BlockingHttpConnection(Connector connector, EndPoint endpoint, Server server)
+	{
+		super(connector,endpoint,server);
+	}
 
-    public BlockingHttpConnection(Connector connector, EndPoint endpoint, Server server, Parser parser, Generator generator, Request request)
-    {
-        super(connector,endpoint,server,parser,generator,request);
-    }
+	public BlockingHttpConnection(Connector connector, EndPoint endpoint, Server server, Parser parser, Generator generator, Request request)
+	{
+		super(connector,endpoint,server,parser,generator,request);
+	}
 
-    @Override
-    protected void handleRequest() throws IOException
-    {
-        super.handleRequest();
-    }
+	@Override
+	protected void handleRequest() throws IOException
+	{
+		super.handleRequest();
+	}
 
-    public Connection handle() throws IOException
-    {
-        Connection connection = this;
+	public Connection handle() throws IOException
+	{
+		Connection connection = this;
 
-        try
-        {
-            setCurrentConnection(this);
+		try
+		{
+			setCurrentConnection(this);
 
-            // do while the endpoint is open
-            // AND the connection has not changed
-            while (_endp.isOpen() && connection==this)
-            {
-                try
-                {
-                    // If we are not ended then parse available
-                    if (!_parser.isComplete() && !_endp.isInputShutdown())
-                        _parser.parseAvailable();
+			// do while the endpoint is open
+			// AND the connection has not changed
+			while (_endp.isOpen() && connection==this)
+			{
+				try
+				{
+					// 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);
-                    _parser.reset();
-                    _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())
+					{
+						LOG.debug("uri="+_uri);
+						LOG.debug("fields="+_requestFields);
+						LOG.debug("",e);
+					}
+					_generator.sendError(e.getStatus(), e.getReason(), null, true);
+					_parser.reset();
+					_endp.shutdownOutput();
+				}
+				finally
+				{
+					//  Is this request/response round complete and are fully flushed?
+					if (_parser.isComplete() && _generator.isComplete())
+					{
+						// Reset the parser/generator
+						reset();
 
-                        // look for a switched connection instance?
-                        if (_response.getStatus()==HttpStatus.SWITCHING_PROTOCOLS_101)
-                        {
-                            Connection switched=(Connection)_request.getAttribute("org.eclipse.jetty.io.Connection");
-                            if (switched!=null)
-                                connection=switched;
-                        }
+						// look for a switched connection instance?
+						if (_response.getStatus()==HttpStatus.SWITCHING_PROTOCOLS_101)
+						{
+							Connection switched=(Connection)_request.getAttribute("org.eclipse.jetty.io.Connection");
+							if (switched!=null)
+								connection=switched;
+						}
 
-                        // 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() && !_request.getAsyncContinuation().isSuspended())
-                    {
-                        // then no more can happen, so close.
-                        _endp.close();
-                    }
-                }
-            }
+						// 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() && !_request.getAsyncContinuation().isSuspended())
+					{
+						// then no more can happen, so close.
+						_endp.close();
+					}
+				}
+			}
 
-            return connection;
-        }
-        finally
-        {
-            setCurrentConnection(null);
-            _parser.returnBuffers();
-            _generator.returnBuffers();
-        }
-    }
+			return connection;
+		}
+		finally
+		{
+			setCurrentConnection(null);
+			_parser.returnBuffers();
+			_generator.returnBuffers();
+		}
+	}
 }