cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1171088 - in /cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra: concurrent/DebuggableThreadPoolExecutor.java net/IncomingTcpConnection.java
Date Thu, 15 Sep 2011 13:18:03 GMT
Author: jbellis
Date: Thu Sep 15 13:18:03 2011
New Revision: 1171088

URL: http://svn.apache.org/viewvc?rev=1171088&view=rev
Log:
merge r1170360 from 1.0.0

Modified:
    cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java
    cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/net/IncomingTcpConnection.java

Modified: cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java?rev=1171088&r1=1171087&r2=1171088&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java
(original)
+++ cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/concurrent/DebuggableThreadPoolExecutor.java
Thu Sep 15 13:18:03 2011
@@ -122,6 +122,10 @@ public class DebuggableThreadPoolExecuto
             {
                 throw new AssertionError(e);
             }
+            catch (CancellationException e)
+            {
+                logger.debug("Task cancelled", e);
+            }
             catch (ExecutionException e)
             {
                 if (Thread.getDefaultUncaughtExceptionHandler() == null)

Modified: cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/net/IncomingTcpConnection.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/net/IncomingTcpConnection.java?rev=1171088&r1=1171087&r2=1171088&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/net/IncomingTcpConnection.java
(original)
+++ cassandra/branches/cassandra-0.8/src/java/org/apache/cassandra/net/IncomingTcpConnection.java
Thu Sep 15 13:18:03 2011
@@ -22,6 +22,7 @@ package org.apache.cassandra.net;
 
 
 import java.io.*;
+import java.net.InetAddress;
 import java.net.Socket;
 
 import org.apache.cassandra.gms.Gossiper;
@@ -41,11 +42,13 @@ public class IncomingTcpConnection exten
     private static final int CHUNK_SIZE = 1024 * 1024;
     
     private Socket socket;
+    public InetAddress from;
 
     public IncomingTcpConnection(Socket socket)
     {
         assert socket != null;
         this.socket = socket;
+        from = socket.getInetAddress(); // maximize chance of this not being nulled by disconnect
     }
 
     /**
@@ -70,8 +73,7 @@ public class IncomingTcpConnection exten
                 // we should buffer
                 input = new DataInputStream(new BufferedInputStream(socket.getInputStream(),
4096));
             version = MessagingService.getBits(header, 15, 8);
-            if (logger.isDebugEnabled())
-                logger.debug("Version for " + socket.getInetAddress() + " is " + version);
+            logger.debug("Version for {} is {}", from, version);
         }
         catch (IOException e)
         {
@@ -83,7 +85,7 @@ public class IncomingTcpConnection exten
         if (version > MessagingService.version_)
         {
             // save the endpoint so gossip will reconnect to it
-            Gossiper.instance.addSavedEndpoint(socket.getInetAddress());
+            Gossiper.instance.addSavedEndpoint(from);
             logger.info("Received " + (isStream ? "streaming " : "") + "connection from newer
protocol version. Ignorning");
 
             // streaming connections are per-session and have a fixed version.  we can't
do anything with a new-version
@@ -99,8 +101,8 @@ public class IncomingTcpConnection exten
         else
         {
             // only set version when <= to us, otherwise it's the responsibility of the
other end to mimic us
-            Gossiper.instance.setVersion(socket.getInetAddress(), version);
-            logger.debug("set version for {} to {}", socket.getInetAddress(), version);
+            Gossiper.instance.setVersion(from, version);
+            logger.debug("set version for {} to {}", from, version);
         }
 
         while (true)
@@ -165,7 +167,8 @@ public class IncomingTcpConnection exten
     private void close()
     {
         // reset version here, since we set when starting an incoming socket
-        Gossiper.instance.resetVersion(socket.getInetAddress());
+        if (from != null)
+            Gossiper.instance.resetVersion(from);
         try
         {
             socket.close();



Mime
View raw message