cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject cassandra git commit: make scanner.close idempotent
Date Wed, 03 Jun 2015 14:28:02 GMT
Repository: cassandra
Updated Branches:
  refs/heads/cassandra-2.2 4c53dc3a9 -> 2a9fc0e88


make scanner.close idempotent

Patch by tjake; reviewed by blerer for CASSANDRA-9531


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

Branch: refs/heads/cassandra-2.2
Commit: 2a9fc0e887612725a51b3822a266c1b3d3fadcaf
Parents: 4c53dc3
Author: T Jake Luciani <jake@apache.org>
Authored: Tue Jun 2 11:41:51 2015 -0400
Committer: T Jake Luciani <jake@apache.org>
Committed: Wed Jun 3 10:20:59 2015 -0400

----------------------------------------------------------------------
 .../apache/cassandra/io/sstable/format/big/BigTableScanner.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/2a9fc0e8/src/java/org/apache/cassandra/io/sstable/format/big/BigTableScanner.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/io/sstable/format/big/BigTableScanner.java b/src/java/org/apache/cassandra/io/sstable/format/big/BigTableScanner.java
index cea9cfa..d477152 100644
--- a/src/java/org/apache/cassandra/io/sstable/format/big/BigTableScanner.java
+++ b/src/java/org/apache/cassandra/io/sstable/format/big/BigTableScanner.java
@@ -19,6 +19,7 @@ package org.apache.cassandra.io.sstable.format.big;
 
 import java.io.IOException;
 import java.util.*;
+import java.util.concurrent.atomic.AtomicBoolean;
 
 import com.google.common.collect.AbstractIterator;
 import com.google.common.collect.Ordering;
@@ -51,6 +52,7 @@ import static org.apache.cassandra.dht.AbstractBounds.minRight;
 
 public class BigTableScanner implements ISSTableScanner
 {
+    private AtomicBoolean isClosed = new AtomicBoolean(false);
     protected final RandomAccessReader dfile;
     protected final RandomAccessReader ifile;
     public final SSTableReader sstable;
@@ -193,7 +195,8 @@ public class BigTableScanner implements ISSTableScanner
 
     public void close() throws IOException
     {
-        FileUtils.close(dfile, ifile);
+        if (isClosed.compareAndSet(false, true))
+            FileUtils.close(dfile, ifile);
     }
 
     public long getLengthInBytes()


Mime
View raw message