Commits

Vijay Parthasarathy  committed c2d9fcd Merge

Merge branch 'cassandra-1.2' into trunk

  • Participants
  • Parent commits 7d49929, db87052

Comments (0)

Files changed (2)

File src/java/org/apache/cassandra/net/OutboundTcpConnection.java

         }
     }
 
-    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);
     }
 
 
     public void run()
     {
-        while (!isStopped)
+        while (true)
         {
             QueuedMessage qm = active.poll();
             if (qm == null)
             if (m == CLOSE_SENTINEL)
             {
                 disconnect();
+                if (!isStopped)
+                    break;
                 continue;
             }
             if (qm.timestamp < System.currentTimeMillis() - m.getTimeout())

File src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java

     void reset()
     {
         for (OutboundTcpConnection conn : new OutboundTcpConnection[] { cmdCon, ackCon })
-            conn.closeSocket();
+            conn.closeSocket(false);
     }
 
     public void resetToNewerVersion(int version)
     {
         // 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();
     }
 }