diff src/org/eclipse/jetty/io/nio/SelectChannelEndPoint.java @ 949:e9088af3787f

remove SelectSet._changes
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 11 Oct 2016 23:18:13 -0600
parents f5aefdc4a81a
children a778413aefc0
line wrap: on
line diff
--- a/src/org/eclipse/jetty/io/nio/SelectChannelEndPoint.java	Tue Oct 11 22:16:29 2016 -0600
+++ b/src/org/eclipse/jetty/io/nio/SelectChannelEndPoint.java	Tue Oct 11 23:18:13 2016 -0600
@@ -501,7 +501,7 @@
 
 		if(changed)
 		{
-			_selectSet.addChange(this);
+			doUpdateKey();
 			_selectSet.wakeup();
 		}
 	}
@@ -511,69 +511,66 @@
 	/**
 	 * Synchronize the interestOps with the actual key. Call is scheduled by a call to updateKey
 	 */
-	void doUpdateKey()
+	synchronized void doUpdateKey()
 	{
-		synchronized (this)
+		if (getChannel().isOpen())
 		{
-			if (getChannel().isOpen())
+			if (_interestOps>0)
 			{
-				if (_interestOps>0)
+				if (_key==null || !_key.isValid())
 				{
-					if (_key==null || !_key.isValid())
+					SelectableChannel sc = (SelectableChannel)getChannel();
+					if (sc.isRegistered())
 					{
-						SelectableChannel sc = (SelectableChannel)getChannel();
-						if (sc.isRegistered())
-						{
-							updateKey();
-						}
-						else
-						{
-							try
-							{
-								_key=((SelectableChannel)getChannel()).register(_selectSet.getSelector(),_interestOps,this);
-							}
-							catch (Exception e)
-							{
-								LOG.trace("",e);
-								if (_key!=null && _key.isValid())
-								{
-									_key.cancel();
-								}
-
-								if (_open)
-								{
-									_selectSet.destroyEndPoint(this);
-								}
-								_open=false;
-								_key = null;
-							}
-						}
+						updateKey();
 					}
 					else
 					{
-						_key.interestOps(_interestOps);
+						try
+						{
+							_key=((SelectableChannel)getChannel()).register(_selectSet.getSelector(),_interestOps,this);
+						}
+						catch (Exception e)
+						{
+							LOG.trace("",e);
+							if (_key!=null && _key.isValid())
+							{
+								_key.cancel();
+							}
+
+							if (_open)
+							{
+								_selectSet.destroyEndPoint(this);
+							}
+							_open=false;
+							_key = null;
+						}
 					}
 				}
 				else
 				{
-					if (_key!=null && _key.isValid())
-						_key.interestOps(0);
-					else
-						_key=null;
+					_key.interestOps(_interestOps);
 				}
 			}
 			else
 			{
 				if (_key!=null && _key.isValid())
-					_key.cancel();
+					_key.interestOps(0);
+				else
+					_key=null;
+			}
+		}
+		else
+		{
+			if (_key!=null && _key.isValid())
+				_key.cancel();
 
-				if (_open)
-				{
-					_open=false;
-					_selectSet.destroyEndPoint(this);
-				}
-				_key = null;
+			if (_open)
+			{
+				_open=false;
+				_selectSet.destroyEndPoint(this);
 			}
+			_key = null;
 		}
 	}