cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jun...@apache.org
Subject svn commit: r809629 - /incubator/cassandra/trunk/src/java/org/apache/cassandra/net/SelectorManager.java
Date Mon, 31 Aug 2009 15:44:42 GMT
Author: junrao
Date: Mon Aug 31 15:44:42 2009
New Revision: 809629

URL: http://svn.apache.org/viewvc?rev=809629&view=rev
Log:
Deadlock with SelectorManager.doProcess and TcpConnection.write; patch by Sammy Yu and junrao;
reviewed by Chris Goffinet for CASSANDRA-392

Modified:
    incubator/cassandra/trunk/src/java/org/apache/cassandra/net/SelectorManager.java

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/net/SelectorManager.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/net/SelectorManager.java?rev=809629&r1=809628&r2=809629&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/net/SelectorManager.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/net/SelectorManager.java Mon Aug
31 15:44:42 2009
@@ -113,35 +113,32 @@
         {
             selector.selectedKeys().remove(key);
 
-            synchronized (key)
+            SelectionKeyHandler skh = (SelectionKeyHandler) key.attachment();
+
+            if (skh != null)
             {
-                SelectionKeyHandler skh = (SelectionKeyHandler) key.attachment();
+                // accept
+                if (key.isValid() && key.isAcceptable())
+                {
+                    skh.accept(key);
+                }
+
+                // connect
+                if (key.isValid() && key.isConnectable())
+                {
+                    skh.connect(key);
+                }
+
+                // read
+                if (key.isValid() && key.isReadable())
+                {
+                    skh.read(key);
+                }
 
-                if (skh != null)
+                // write
+                if (key.isValid() && key.isWritable())
                 {
-                    // accept
-                    if (key.isValid() && key.isAcceptable())
-                    {
-                        skh.accept(key);
-                    }
-
-                    // connect
-                    if (key.isValid() && key.isConnectable())
-                    {
-                        skh.connect(key);
-                    }
-
-                    // read
-                    if (key.isValid() && key.isReadable())
-                    {
-                        skh.read(key);
-                    }
-
-                    // write
-                    if (key.isValid() && key.isWritable())
-                    {
-                        skh.write(key);
-                    }
+                    skh.write(key);
                 }
             }
         }



Mime
View raw message