cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ble...@apache.org
Subject cassandra git commit: Cleanup a few resource warnings
Date Mon, 29 Feb 2016 10:14:06 GMT
Repository: cassandra
Updated Branches:
  refs/heads/trunk ace7fe03d -> 6a4d10628


Cleanup a few resource warnings

patch by Benjamin Lerer; reviewed by Jason Brown for CASSANDRA-11085


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

Branch: refs/heads/trunk
Commit: 6a4d106287adaf64280dce96632066b6c8d7d194
Parents: ace7fe0
Author: Benjamin Lerer <b.lerer@gmail.com>
Authored: Mon Feb 29 11:11:23 2016 +0100
Committer: Benjamin Lerer <b.lerer@gmail.com>
Committed: Mon Feb 29 11:11:23 2016 +0100

----------------------------------------------------------------------
 CHANGES.txt                                                      | 1 +
 src/java/org/apache/cassandra/db/ColumnFamilyStore.java          | 1 +
 .../cassandra/db/compaction/writers/MaxSSTableSizeWriter.java    | 4 +---
 .../compaction/writers/SplittingSizeTieredCompactionWriter.java  | 2 +-
 .../apache/cassandra/hints/CompressedChecksummedDataInput.java   | 1 +
 src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java | 1 +
 6 files changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/6a4d1062/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 425e284..3da462e 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 3.4
+ * Cleanup a few resource warnings (CASSANDRA-11085)
  * Allow custom tracing implementations (CASSANDRA-10392)
  * Extract LoaderOptions to be able to be used from outside (CASSANDRA-10637)
  * fix OnDiskIndexTest to properly treat empty ranges (CASSANDRA-11205)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6a4d1062/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
index fa95063..3b5e745 100644
--- a/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
+++ b/src/java/org/apache/cassandra/db/ColumnFamilyStore.java
@@ -1070,6 +1070,7 @@ public class ColumnFamilyStore implements ColumnFamilyStoreMBean
                         Iterator<SSTableMultiWriter> writerIterator = flushResults.iterator();
                         while (writerIterator.hasNext())
                         {
+                            @SuppressWarnings("resource")
                             SSTableMultiWriter writer = writerIterator.next();
                             if (writer.getFilePointer() > 0)
                             {

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6a4d1062/src/java/org/apache/cassandra/db/compaction/writers/MaxSSTableSizeWriter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/compaction/writers/MaxSSTableSizeWriter.java
b/src/java/org/apache/cassandra/db/compaction/writers/MaxSSTableSizeWriter.java
index 228a3a5..609c898 100644
--- a/src/java/org/apache/cassandra/db/compaction/writers/MaxSSTableSizeWriter.java
+++ b/src/java/org/apache/cassandra/db/compaction/writers/MaxSSTableSizeWriter.java
@@ -17,8 +17,6 @@
  */
 package org.apache.cassandra.db.compaction.writers;
 
-import java.io.File;
-import java.util.List;
 import java.util.Set;
 
 import org.apache.cassandra.db.ColumnFamilyStore;
@@ -64,7 +62,6 @@ public class MaxSSTableSizeWriter extends CompactionAwareWriter
         this(cfs, directories, txn, nonExpiredSSTables, maxSSTableSize, level, keepOriginals);
     }
 
-    @SuppressWarnings("resource")
     public MaxSSTableSizeWriter(ColumnFamilyStore cfs,
                                 Directories directories,
                                 LifecycleTransaction txn,
@@ -95,6 +92,7 @@ public class MaxSSTableSizeWriter extends CompactionAwareWriter
     public void switchCompactionLocation(Directories.DataDirectory location)
     {
         sstableDirectory = location;
+        @SuppressWarnings("resource")
         SSTableWriter writer = SSTableWriter.create(Descriptor.fromFilename(cfs.getSSTablePath(getDirectories().getLocationForDisk(sstableDirectory))),
                                                     estimatedTotalKeys / estimatedSSTables,
                                                     minRepairedAt,

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6a4d1062/src/java/org/apache/cassandra/db/compaction/writers/SplittingSizeTieredCompactionWriter.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/compaction/writers/SplittingSizeTieredCompactionWriter.java
b/src/java/org/apache/cassandra/db/compaction/writers/SplittingSizeTieredCompactionWriter.java
index 75a42e7..290e88b 100644
--- a/src/java/org/apache/cassandra/db/compaction/writers/SplittingSizeTieredCompactionWriter.java
+++ b/src/java/org/apache/cassandra/db/compaction/writers/SplittingSizeTieredCompactionWriter.java
@@ -58,7 +58,6 @@ public class SplittingSizeTieredCompactionWriter extends CompactionAwareWriter
         this(cfs, directories, txn, nonExpiredSSTables, DEFAULT_SMALLEST_SSTABLE_BYTES);
     }
 
-    @SuppressWarnings("resource")
     public SplittingSizeTieredCompactionWriter(ColumnFamilyStore cfs, Directories directories,
LifecycleTransaction txn, Set<SSTableReader> nonExpiredSSTables, long smallestSSTable)
     {
         super(cfs, directories, txn, nonExpiredSSTables, false, false);
@@ -105,6 +104,7 @@ public class SplittingSizeTieredCompactionWriter extends CompactionAwareWriter
     {
         this.location = location;
         long currentPartitionsToWrite = Math.round(ratios[currentRatioIndex] * estimatedTotalKeys);
+        @SuppressWarnings("resource")
         SSTableWriter writer = SSTableWriter.create(Descriptor.fromFilename(cfs.getSSTablePath(getDirectories().getLocationForDisk(location))),
                                                     currentPartitionsToWrite,
                                                     minRepairedAt,

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6a4d1062/src/java/org/apache/cassandra/hints/CompressedChecksummedDataInput.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/hints/CompressedChecksummedDataInput.java b/src/java/org/apache/cassandra/hints/CompressedChecksummedDataInput.java
index bbf1fdb..c43e46e 100644
--- a/src/java/org/apache/cassandra/hints/CompressedChecksummedDataInput.java
+++ b/src/java/org/apache/cassandra/hints/CompressedChecksummedDataInput.java
@@ -115,6 +115,7 @@ public final class CompressedChecksummedDataInput extends ChecksummedDataInput
         throw new UnsupportedOperationException();
     }
 
+    @SuppressWarnings("resource") // Closing the ChecksummedDataInput will close the underlying
channel.
     public static ChecksummedDataInput upgradeInput(ChecksummedDataInput input, ICompressor
compressor)
     {
         long position = input.getPosition();

http://git-wip-us.apache.org/repos/asf/cassandra/blob/6a4d1062/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java b/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java
index 5699c5a..ecadf89 100644
--- a/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java
+++ b/src/java/org/apache/cassandra/net/OutboundTcpConnectionPool.java
@@ -122,6 +122,7 @@ public class OutboundTcpConnectionPool
         return newSocket(endPoint());
     }
 
+    @SuppressWarnings("resource") // Closing the socket will close the underlying channel.
     public static Socket newSocket(InetAddress endpoint) throws IOException
     {
         // zero means 'bind on any available port.'


Mime
View raw message