diff src/org/eclipse/jetty/io/nio/SelectChannelEndPoint.java @ 960:3cd4c706a61f

simplify ChannelEndPoint
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 13 Oct 2016 21:29:19 -0600
parents 7b94f5b33c64
children 790c01734386
line wrap: on
line diff
--- a/src/org/eclipse/jetty/io/nio/SelectChannelEndPoint.java	Thu Oct 13 18:53:26 2016 -0600
+++ b/src/org/eclipse/jetty/io/nio/SelectChannelEndPoint.java	Thu Oct 13 21:29:19 2016 -0600
@@ -172,19 +172,6 @@
 		}
 	}
 
-	/* ------------------------------------------------------------ */
-	/**
-	 * Called when a dispatched thread is no longer handling the endpoint.
-	 * The selection key operations are updated.
-	 * @return If false is returned, the endpoint has been redispatched and
-	 * thread must keep handling the endpoint.
-	 */
-	private synchronized void undispatch()
-	{
-		_state = STATE_UNDISPATCHED;
-		updateKey();
-	}
-
 	@Override
 	public int fill(Buffer buffer) throws IOException
 	{
@@ -432,7 +419,6 @@
 
 	private void handle()
 	{
-		boolean dispatched = true;
 		try
 		{
 			try
@@ -440,13 +426,10 @@
 				while(true)
 				{
 					final AsyncConnection next = (AsyncConnection)_connection.handle();
-					if (next!=_connection)
-					{
-						LOG.debug("{} replaced {}",next,_connection);
-						_connection=next;
-						continue;
-					}
-					break;
+					if (next==_connection)
+						break;
+					LOG.debug("{} replaced {}",next,_connection);
+					_connection=next;
 				}
 			}
 			catch (ClosedChannelException e)
@@ -486,21 +469,13 @@
 						try{close();}
 						catch(IOException e2){LOG.trace("",e2);}
 					}
-					finally
-					{
-						updateKey();
-					}
 				}
-				undispatch();
-				dispatched = false;
 			}
 		}
 		finally
 		{
-			if (dispatched)
-			{
-				undispatch();
-			}
+			_state = STATE_UNDISPATCHED;
+			updateKey();
 		}
 	}