kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From guozh...@apache.org
Subject kafka git commit: MINOR: Use `close()` instead of `dispose()` in various RocksDB classes
Date Tue, 02 Aug 2016 21:33:54 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk e62dd4cb7 -> c840f2a95


MINOR: Use `close()` instead of `dispose()` in various RocksDB classes

The latter has been deprecated.

Author: Ismael Juma <ismael@juma.me.uk>

Reviewers: Guozhang Wang <wangguoz@gmail.com>

Closes #1690 from ijuma/rocks-db-dispose-methods-deprecated


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

Branch: refs/heads/trunk
Commit: c840f2a95c2e247c384315846067daa839df77a7
Parents: e62dd4c
Author: Ismael Juma <ismael@juma.me.uk>
Authored: Tue Aug 2 14:33:50 2016 -0700
Committer: Guozhang Wang <wangguoz@gmail.com>
Committed: Tue Aug 2 14:33:50 2016 -0700

----------------------------------------------------------------------
 .../kafka/streams/state/internals/RocksDBStore.java | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/c840f2a9/streams/src/main/java/org/apache/kafka/streams/state/internals/RocksDBStore.java
----------------------------------------------------------------------
diff --git a/streams/src/main/java/org/apache/kafka/streams/state/internals/RocksDBStore.java
b/streams/src/main/java/org/apache/kafka/streams/state/internals/RocksDBStore.java
index 4993173..4d41b42 100644
--- a/streams/src/main/java/org/apache/kafka/streams/state/internals/RocksDBStore.java
+++ b/streams/src/main/java/org/apache/kafka/streams/state/internals/RocksDBStore.java
@@ -88,7 +88,7 @@ public class RocksDBStore<K, V> implements KeyValueStore<K, V>
{
 
     private RocksDB db;
 
-    // the following option objects will be created at constructor and disposed at close()
+    // the following option objects will be created in the constructor and closed in the
close() method
     private Options options;
     private WriteOptions wOptions;
     private FlushOptions fOptions;
@@ -349,9 +349,7 @@ public class RocksDBStore<K, V> implements KeyValueStore<K, V>
{
 
     // this function is only called in flushCache()
     private void putAllInternal(List<KeyValue<byte[], byte[]>> entries) {
-        WriteBatch batch = new WriteBatch();
-
-        try {
+        try (WriteBatch batch = new WriteBatch()) {
             for (KeyValue<byte[], byte[]> entry : entries) {
                 batch.put(entry.key, entry.value);
             }
@@ -359,8 +357,6 @@ public class RocksDBStore<K, V> implements KeyValueStore<K, V>
{
             db.write(wOptions, batch);
         } catch (RocksDBException e) {
             throw new ProcessorStateException("Error while batch writing to store " + this.name,
e);
-        } finally {
-            batch.dispose();
         }
     }
 
@@ -513,9 +509,9 @@ public class RocksDBStore<K, V> implements KeyValueStore<K, V>
{
         }
         open = false;
         flush();
-        options.dispose();
-        wOptions.dispose();
-        fOptions.dispose();
+        options.close();
+        wOptions.close();
+        fOptions.close();
         db.close();
 
         options = null;
@@ -569,7 +565,7 @@ public class RocksDBStore<K, V> implements KeyValueStore<K, V>
{
 
         @Override
         public void close() {
-            iter.dispose();
+            iter.close();
         }
 
     }


Mime
View raw message