cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject [1/3] git commit: enhance assertion failure message
Date Thu, 12 Dec 2013 20:31:05 GMT
Updated Branches:
  refs/heads/cassandra-2.0 0d8da2ee3 -> c4d3a3138
  refs/heads/trunk a9b93c257 -> b25ae0f92


enhance assertion failure message


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

Branch: refs/heads/cassandra-2.0
Commit: c4d3a313885f14e802247b9354aafa4caaae9804
Parents: 0d8da2e
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Fri Dec 13 02:30:38 2013 +0600
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Fri Dec 13 02:30:38 2013 +0600

----------------------------------------------------------------------
 src/java/org/apache/cassandra/net/CallbackInfo.java     | 9 +++++++++
 src/java/org/apache/cassandra/net/MessagingService.java | 4 ++--
 2 files changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/c4d3a313/src/java/org/apache/cassandra/net/CallbackInfo.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/net/CallbackInfo.java b/src/java/org/apache/cassandra/net/CallbackInfo.java
index 0edfee9..3e584b4 100644
--- a/src/java/org/apache/cassandra/net/CallbackInfo.java
+++ b/src/java/org/apache/cassandra/net/CallbackInfo.java
@@ -50,4 +50,13 @@ public class CallbackInfo
     {
         return false;
     }
+
+    public String toString()
+    {
+        return "CallbackInfo(" +
+               "target=" + target +
+               ", callback=" + callback +
+               ", serializer=" + serializer +
+               ')';
+    }
 }

http://git-wip-us.apache.org/repos/asf/cassandra/blob/c4d3a313/src/java/org/apache/cassandra/net/MessagingService.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/net/MessagingService.java b/src/java/org/apache/cassandra/net/MessagingService.java
index 2259dbd..20cad82 100644
--- a/src/java/org/apache/cassandra/net/MessagingService.java
+++ b/src/java/org/apache/cassandra/net/MessagingService.java
@@ -535,7 +535,7 @@ public final class MessagingService implements MessagingServiceMBean
         assert message.verb != Verb.MUTATION; // mutations need to call the overload with
a ConsistencyLevel
         int messageId = nextId();
         CallbackInfo previous = callbacks.put(messageId, new CallbackInfo(to, cb, callbackDeserializers.get(message.verb)),
timeout);
-        assert previous == null;
+        assert previous == null : String.format("Callback already exists for id %d! (%s)",
messageId, previous);
         return messageId;
     }
 
@@ -544,7 +544,7 @@ public final class MessagingService implements MessagingServiceMBean
         assert message.verb == Verb.MUTATION || message.verb == Verb.COUNTER_MUTATION;
         int messageId = nextId();
         CallbackInfo previous = callbacks.put(messageId, new WriteCallbackInfo(to, cb, message,
callbackDeserializers.get(message.verb), consistencyLevel), timeout);
-        assert previous == null;
+        assert previous == null : String.format("Callback already exists for id %d! (%s)",
messageId, previous);
         return messageId;
     }
 


Mime
View raw message