cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vi...@apache.org
Subject git commit: Fix test failures for CASSANDRA-5175
Date Wed, 23 Jan 2013 07:45:04 GMT
Updated Branches:
  refs/heads/cassandra-1.2 096346927 -> db8705294


Fix test failures for CASSANDRA-5175

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

Branch: refs/heads/cassandra-1.2
Commit: db8705294ba96fe2b746fea4f26a919538653ebd
Parents: 0963469
Author: Vijay Parthasarathy <vijay2win@gmail.com>
Authored: Tue Jan 22 23:44:43 2013 -0800
Committer: Vijay Parthasarathy <vijay2win@gmail.com>
Committed: Tue Jan 22 23:44:43 2013 -0800

----------------------------------------------------------------------
 .../cassandra/net/OutboundTcpConnection.java       |    8 +++++---
 .../cassandra/net/OutboundTcpConnectionPool.java   |    6 +++---
 2 files changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/db870529/src/java/org/apache/cassandra/net/OutboundTcpConnection.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/net/OutboundTcpConnection.java b/src/java/org/apache/cassandra/net/OutboundTcpConnection.java
index 1572417..90d054e 100644
--- a/src/java/org/apache/cassandra/net/OutboundTcpConnection.java
+++ b/src/java/org/apache/cassandra/net/OutboundTcpConnection.java
@@ -89,11 +89,11 @@ public class OutboundTcpConnection extends Thread
         }
     }
 
-    void closeSocket()
+    void closeSocket(boolean destroyThread)
     {
         active.clear();
         backlog.clear();
-        isStopped = true; // Exit loop to stop the thread
+        isStopped = destroyThread; // Exit loop to stop the thread
         enqueue(CLOSE_SENTINEL, null);
     }
 
@@ -109,7 +109,7 @@ public class OutboundTcpConnection extends Thread
 
     public void run()
     {
-        while (!isStopped)
+        while (true)
         {
             QueuedMessage qm = active.poll();
             if (qm == null)
@@ -133,6 +133,8 @@ public class OutboundTcpConnection extends Thread
             if (m == CLOSE_SENTINEL)
             {
                 disconnect();
+                if (!isStopped)
+                    break;
                 continue;
             }
             if (qm.timestamp < System.currentTimeMillis() - m.getTimeout())

http://git-wip-us.apache.org/repos/asf/cassandra/blob/db870529/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java b/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java
index 237363d..88cad5b 100644
--- a/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java
+++ b/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java
@@ -68,7 +68,7 @@ public class OutboundTcpConnectionPool
     void reset()
     {
         for (OutboundTcpConnection conn : new OutboundTcpConnection[] { cmdCon, ackCon })
-            conn.closeSocket();
+            conn.closeSocket(false);
     }
 
     public void resetToNewerVersion(int version)
@@ -161,9 +161,9 @@ public class OutboundTcpConnectionPool
     {
         // these null guards are simply for tests
         if (ackCon != null)
-            ackCon.closeSocket();
+            ackCon.closeSocket(true);
         if (cmdCon != null)
-            cmdCon.closeSocket();
+            cmdCon.closeSocket(true);
         metrics.release();
     }
 }


Mime
View raw message