cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject [3/6] cassandra git commit: Fix Mutation.applyUnsafe to block
Date Wed, 03 Feb 2016 13:35:18 GMT
Fix Mutation.applyUnsafe to block

Patch by Carl Yeksigian; reviewed by Jake Luciani for CASSANDRA-10779


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

Branch: refs/heads/trunk
Commit: c4d83f1ba31735963b451beb38a553c92145d5d4
Parents: 2081385
Author: Carl Yeksigian <carl@apache.org>
Authored: Wed Feb 3 08:33:31 2016 -0500
Committer: Carl Yeksigian <carl@apache.org>
Committed: Wed Feb 3 08:33:31 2016 -0500

----------------------------------------------------------------------
 src/java/org/apache/cassandra/db/Mutation.java | 27 ++++++++++++---------
 1 file changed, 16 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/c4d83f1b/src/java/org/apache/cassandra/db/Mutation.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/Mutation.java b/src/java/org/apache/cassandra/db/Mutation.java
index 6b4c8e9..1ba3740 100644
--- a/src/java/org/apache/cassandra/db/Mutation.java
+++ b/src/java/org/apache/cassandra/db/Mutation.java
@@ -198,21 +198,22 @@ public class Mutation implements IMutation
         return new Mutation(ks, key, modifications);
     }
 
-    public CompletableFuture<?> applyFuture()
+    private CompletableFuture<?> applyFuture(boolean durableWrites)
     {
         Keyspace ks = Keyspace.open(keyspaceName);
-        return ks.apply(this, ks.getMetadata().params.durableWrites);
+        return ks.apply(this, durableWrites);
     }
 
-    /*
-     * This is equivalent to calling commit. Applies the changes to
-     * to the keyspace that is obtained by calling Keyspace.open().
-     */
-    public void apply()
+    public CompletableFuture<?> applyFuture()
+    {
+        return applyFuture(Keyspace.open(keyspaceName).getMetadata().params.durableWrites);
+    }
+
+    public void apply(boolean durableWrites)
     {
         try
         {
-            Uninterruptibles.getUninterruptibly(applyFuture());
+            Uninterruptibles.getUninterruptibly(applyFuture(durableWrites));
         }
         catch (ExecutionException e)
         {
@@ -220,14 +221,18 @@ public class Mutation implements IMutation
         }
     }
 
-    public void apply(boolean durableWrites)
+    /*
+     * This is equivalent to calling commit. Applies the changes to
+     * to the keyspace that is obtained by calling Keyspace.open().
+     */
+    public void apply()
     {
-        Keyspace.open(keyspaceName).apply(this, durableWrites);
+        apply(Keyspace.open(keyspaceName).getMetadata().params.durableWrites);
     }
 
     public void applyUnsafe()
     {
-        Keyspace.open(keyspaceName).apply(this, false);
+        apply(false);
     }
 
     public MessageOut<Mutation> createMessage()


Mime
View raw message