Small optimization: call readyOps() outside spin lock.

This commit is contained in:
Simone Bordet 2015-05-26 12:25:06 +02:00
parent c25772e147
commit 72222ba8a3
1 changed files with 1 additions and 3 deletions

View File

@ -85,15 +85,13 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements ManagedSel
* This method may run concurrently with {@link #changeInterests(int)}.
*/
int readyOps;
int readyOps = _key.readyOps();
int oldInterestOps;
int newInterestOps;
try (SpinLock.Lock lock = _lock.lock())
{
_updatePending = true;
// Remove the readyOps, that here can only be OP_READ or OP_WRITE (or both).
readyOps = _key.readyOps();
oldInterestOps = _desiredInterestOps;
newInterestOps = oldInterestOps & ~readyOps;
_desiredInterestOps = newInterestOps;