changeset 965:866f2e801618

handle() returns void
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 14 Oct 2016 02:19:21 -0600
parents 768414c16e10
children 2ac9e57ccae6
files src/org/eclipse/jetty/io/Connection.java src/org/eclipse/jetty/io/nio/ChannelEndPoint.java src/org/eclipse/jetty/io/nio/SelectChannelEndPoint.java src/org/eclipse/jetty/io/nio/SslConnection.java src/org/eclipse/jetty/server/AbstractHttpConnection.java src/org/eclipse/jetty/server/AsyncHttpConnection.java src/org/eclipse/jetty/server/BlockingHttpConnection.java src/org/eclipse/jetty/server/nio/BlockingChannelConnector.java
diffstat 8 files changed, 10 insertions(+), 56 deletions(-) [+]
line wrap: on
line diff
--- a/src/org/eclipse/jetty/io/Connection.java	Fri Oct 14 01:03:47 2016 -0600
+++ b/src/org/eclipse/jetty/io/Connection.java	Fri Oct 14 02:19:21 2016 -0600
@@ -37,11 +37,9 @@
     /* ------------------------------------------------------------ */
     /**
      * Handle the connection.
-     * @return The Connection to use for the next handling of the connection.
-     * This allows protocol upgrades and support for CONNECT.
      * @throws IOException if the handling of I/O operations fail
      */
-    Connection handle() throws IOException;
+    void handle() throws IOException;
 
     /**
      * @return the timestamp at which the connection was created
--- a/src/org/eclipse/jetty/io/nio/ChannelEndPoint.java	Fri Oct 14 01:03:47 2016 -0600
+++ b/src/org/eclipse/jetty/io/nio/ChannelEndPoint.java	Fri Oct 14 02:19:21 2016 -0600
@@ -446,19 +446,16 @@
 		return _channel;
 	}
 
-	/* ------------------------------------------------------------ */
 	public void flush()
 		throws IOException
 	{
 	}
 
-	/* ------------------------------------------------------------ */
 	public int getMaxIdleTime()
 	{
 		return _maxIdleTime;
 	}
 
-	/* ------------------------------------------------------------ */
 	public void setMaxIdleTime(int timeMs) throws IOException
 	{
 		if (_socket!=null && timeMs!=_maxIdleTime)
--- a/src/org/eclipse/jetty/io/nio/SelectChannelEndPoint.java	Fri Oct 14 01:03:47 2016 -0600
+++ b/src/org/eclipse/jetty/io/nio/SelectChannelEndPoint.java	Fri Oct 14 02:19:21 2016 -0600
@@ -345,14 +345,7 @@
 		{
 			try
 			{
-				while(true)
-				{
-					final AsyncConnection next = (AsyncConnection)_connection.handle();
-					if (next==_connection)
-						break;
-					LOG.debug("{} replaced {}",next,_connection);
-					_connection=next;
-				}
+				_connection.handle();
 			}
 			catch (ClosedChannelException e)
 			{
@@ -401,10 +394,6 @@
 		}
 	}
 
-	/* ------------------------------------------------------------ */
-	/*
-	 * @see org.eclipse.io.nio.ChannelEndPoint#close()
-	 */
 	@Override
 	public void close() throws IOException
 	{
--- a/src/org/eclipse/jetty/io/nio/SslConnection.java	Fri Oct 14 01:03:47 2016 -0600
+++ b/src/org/eclipse/jetty/io/nio/SslConnection.java	Fri Oct 14 02:19:21 2016 -0600
@@ -168,7 +168,7 @@
 	}
 
 	@Override
-	public Connection handle() throws IOException
+	public void handle() throws IOException
 	{
 		try
 		{
@@ -185,12 +185,7 @@
 					progress=process(null,null);
 
 				// handle the delegate connection
-				AsyncConnection next = (AsyncConnection)_connection.handle();
-				if (next!=_connection && next!=null)
-				{
-					_connection = next;
-					progress = true;
-				}
+				_connection.handle();
 
 				_logger.debug("{} handle {} progress={}", _session, this, progress);
 			}
@@ -215,8 +210,6 @@
 				}
 			}
 		}
-
-		return this;
 	}
 
 	public boolean isIdle()
--- a/src/org/eclipse/jetty/server/AbstractHttpConnection.java	Fri Oct 14 01:03:47 2016 -0600
+++ b/src/org/eclipse/jetty/server/AbstractHttpConnection.java	Fri Oct 14 02:19:21 2016 -0600
@@ -512,9 +512,7 @@
 		}
 	}
 
-	public abstract Connection handle() throws IOException;
 
-	/* ------------------------------------------------------------ */
 	public void commitResponse(boolean last) throws IOException
 	{
 		if (!_generator.isCommitted())
--- a/src/org/eclipse/jetty/server/AsyncHttpConnection.java	Fri Oct 14 01:03:47 2016 -0600
+++ b/src/org/eclipse/jetty/server/AsyncHttpConnection.java	Fri Oct 14 02:19:21 2016 -0600
@@ -52,9 +52,8 @@
 	}
 
 	@Override
-	public Connection handle() throws IOException
+	public void handle() throws IOException
 	{
-		Connection connection = this;
 		boolean some_progress = false;
 		boolean progress = true;
 
@@ -63,7 +62,7 @@
 			setCurrentConnection(this);
 
 			// While progress and the connection has not changed
-			while (progress && connection==this)
+			while (progress)
 			{
 				progress=false;
 				try
@@ -109,14 +108,6 @@
 							// Reset the parser/generator
 							progress=true;
 
-							// 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;
-							}
-
 							reset();
 
 							// TODO Is this still required?
@@ -162,7 +153,6 @@
 				}
 			}
 		}
-		return connection;
 	}
 
 	public void onInputShutdown() throws IOException
--- a/src/org/eclipse/jetty/server/BlockingHttpConnection.java	Fri Oct 14 01:03:47 2016 -0600
+++ b/src/org/eclipse/jetty/server/BlockingHttpConnection.java	Fri Oct 14 02:19:21 2016 -0600
@@ -53,17 +53,16 @@
 		super.handleRequest();
 	}
 
-	public Connection handle() throws IOException
+	@Override
+	public void handle() throws IOException
 	{
-		Connection connection = this;
-
 		try
 		{
 			setCurrentConnection(this);
 
 			// do while the endpoint is open
 			// AND the connection has not changed
-			while (_endp.isOpen() && connection==this)
+			while (_endp.isOpen())
 			{
 				try
 				{
@@ -101,14 +100,6 @@
 						// 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;
-						}
-
 						// TODO Is this required?
 						if (!_generator.isPersistent() && !_endp.isOutputShutdown())
 						{
@@ -125,8 +116,6 @@
 					}
 				}
 			}
-
-			return connection;
 		}
 		finally
 		{
--- a/src/org/eclipse/jetty/server/nio/BlockingChannelConnector.java	Fri Oct 14 01:03:47 2016 -0600
+++ b/src/org/eclipse/jetty/server/nio/BlockingChannelConnector.java	Fri Oct 14 02:19:21 2016 -0600
@@ -252,7 +252,7 @@
 						}
 					}
 
-					_connection = _connection.handle();
+					_connection.handle();
 
 				}
 			}