You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by vi...@apache.org on 2012/06/26 03:39:42 UTC

git commit: hsha server may stop responding and will not close selectors patch by Viktor Kuzmin; reviewed by Vijay for CASSANDRA-4370

Updated Branches:
  refs/heads/trunk 17f64320d -> 0240cc9df


hsha server may stop responding and will not close selectors
patch by Viktor Kuzmin; reviewed by Vijay for CASSANDRA-4370


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/0240cc9d
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/0240cc9d
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/0240cc9d

Branch: refs/heads/trunk
Commit: 0240cc9dfaac62660af61bfee2df42f71a1d4b3e
Parents: 17f6432
Author: Vijay Parthasarathy <vi...@gmail.com>
Authored: Mon Jun 25 18:38:03 2012 -0700
Committer: Vijay Parthasarathy <vi...@gmail.com>
Committed: Mon Jun 25 18:38:03 2012 -0700

----------------------------------------------------------------------
 .../apache/cassandra/thrift/CustomTHsHaServer.java |   44 +++++++++-----
 1 files changed, 28 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/0240cc9d/src/java/org/apache/cassandra/thrift/CustomTHsHaServer.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/thrift/CustomTHsHaServer.java b/src/java/org/apache/cassandra/thrift/CustomTHsHaServer.java
index 9c307b3..c6517a2 100644
--- a/src/java/org/apache/cassandra/thrift/CustomTHsHaServer.java
+++ b/src/java/org/apache/cassandra/thrift/CustomTHsHaServer.java
@@ -173,6 +173,13 @@ public class CustomTHsHaServer extends TNonblockingServer
                 {
                     select();
                 }
+            }
+            catch (Throwable t)
+            {
+                LOGGER.error("Uncaught Exception: ", t);
+            }
+            finally
+            {
                 try
                 {
                     selector.close(); // CASSANDRA-3867
@@ -182,10 +189,6 @@ public class CustomTHsHaServer extends TNonblockingServer
                     // ignore this exception.
                 }
             }
-            catch (Throwable t)
-            {
-                LOGGER.error("Uncaught Exception: ", t);
-            }
         }
 
         private void select() throws InterruptedException, IOException
@@ -197,21 +200,30 @@ public class CustomTHsHaServer extends TNonblockingServer
             {
                 SelectionKey key = keyIterator.next();
                 keyIterator.remove();
-                if (!key.isValid())
+
+                try
                 {
-                    // if invalid cleanup.
+                    if (!key.isValid())
+                    {
+                        // if invalid cleanup.
+                        cleanupSelectionkey(key);
+                        continue;
+                    }
+
+                    if (key.isAcceptable())
+                        handleAccept();
+                    if (key.isReadable())
+                        handleRead(key);
+                    else if (key.isWritable())
+                        handleWrite(key);
+                    else
+                        LOGGER.debug("Unexpected state " + key.interestOps());
+                }
+                catch (Exception io)
+                {
+                    // just ignore (?)
                     cleanupSelectionkey(key);
-                    continue;
                 }
-
-                if (key.isAcceptable())
-                    handleAccept();
-                if (key.isReadable())
-                    handleRead(key);
-                else if (key.isWritable())
-                    handleWrite(key);
-                else
-                    LOGGER.debug("Unexpected state " + key.interestOps());
             }
             // process the changes which are inserted after completion.
             processInterestChanges();