You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by sl...@apache.org on 2012/06/26 17:55:14 UTC
[3/3] git commit: hsha server may stop responding and will not close
selectors patch by Viktor Kuzmin; reviewed by Vijay for CASSANDRA-4370
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/a846cd65
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/a846cd65
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/a846cd65
Branch: refs/heads/trunk
Commit: a846cd659ee1f3f1adcfc9dbf40e63c05ea8cde2
Parents: 112ce0c
Author: Vijay Parthasarathy <vi...@gmail.com>
Authored: Mon Jun 25 18:41:22 2012 -0700
Committer: Vijay Parthasarathy <vi...@gmail.com>
Committed: Mon Jun 25 18:41:22 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/a846cd65/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 9f7b0cf..350a13d 100644
--- a/src/java/org/apache/cassandra/thrift/CustomTHsHaServer.java
+++ b/src/java/org/apache/cassandra/thrift/CustomTHsHaServer.java
@@ -177,6 +177,13 @@ public class CustomTHsHaServer extends TNonblockingServer
{
select();
}
+ }
+ catch (Throwable t)
+ {
+ LOGGER.error("Uncaught Exception: ", t);
+ }
+ finally
+ {
try
{
selector.close(); // CASSANDRA-3867
@@ -186,10 +193,6 @@ public class CustomTHsHaServer extends TNonblockingServer
// ignore this exception.
}
}
- catch (Throwable t)
- {
- LOGGER.error("Uncaught Exception: ", t);
- }
}
private void select() throws InterruptedException, IOException
@@ -201,21 +204,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();