harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From regi...@apache.org
Subject svn commit: r825747 - /harmony/enhanced/classlib/trunk/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SelectorImpl.java
Date Fri, 16 Oct 2009 02:52:59 GMT
Author: regisxu
Date: Fri Oct 16 02:52:58 2009
New Revision: 825747

URL: http://svn.apache.org/viewvc?rev=825747&view=rev
Log:
set index of SelectionKey in addKey(SelectionKeyImpl)

Modified:
    harmony/enhanced/classlib/trunk/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SelectorImpl.java

Modified: harmony/enhanced/classlib/trunk/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SelectorImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SelectorImpl.java?rev=825747&r1=825746&r2=825747&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SelectorImpl.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/nio/src/main/java/common/org/apache/harmony/nio/internal/SelectorImpl.java
Fri Oct 16 02:52:58 2009
@@ -244,7 +244,7 @@
      *            key to add
      * @return index in the storage
      */
-    private int addKey(SelectionKeyImpl sk) {
+    private void addKey(SelectionKeyImpl sk) {
 
         lastKeyIndex++;
         int c = lastKeyIndex;
@@ -288,8 +288,7 @@
 
             writableKeysCount++;
         }
-
-        return c;
+        sk.setIndex(c);
     }
 
     /**
@@ -395,8 +394,7 @@
                 synchronized (selectedKeys) {
                     SelectionKeyImpl ski = (SelectionKeyImpl) sk;
                     delKey(ski);
-                    int newIndex = addKey(ski);
-                    ski.setIndex(newIndex);
+                    addKey(ski);
                 }
             }
         }
@@ -417,8 +415,7 @@
                 // create the key
                 SelectionKeyImpl selectionKey = new SelectionKeyImpl(
                         channel, operations, attachment, this);
-                int index = addKey(selectionKey);
-                selectionKey.setIndex(index);
+                addKey(selectionKey);
                 mutableKeys.add(selectionKey);
                 return selectionKey;
             }



Mime
View raw message