This is an automated email from the ASF dual-hosted git repository.

sewen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git

commit 6955ba77dd11c99cde31c990a4d2c9f8ee57232a
Author: Stephan Ewen <se...@apache.org>
AuthorDate: Mon Dec 9 18:31:58 2019 +0100

    [hotfix][state-backend-rocksdb] Some minor style cleanups in 
RocksDBResourceContainer
    
      - Make visibility consistent package private (was mix of package private 
and public)
      - remove unused method
      - Adjust line spacing between fields
      - Add some JavaDocs
      - Make final (not designed for inheritance)
      - Nullable annotations
---
 .../streaming/state/RocksDBResourceContainer.java   | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git 
a/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBResourceContainer.java
 
b/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBResourceContainer.java
index 6e0f23c..4cb18d8 100644
--- 
a/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBResourceContainer.java
+++ 
b/flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBResourceContainer.java
@@ -25,25 +25,32 @@ import org.rocksdb.ColumnFamilyOptions;
 import org.rocksdb.DBOptions;
 
 import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
 
 import java.util.ArrayList;
 
 /**
  * The container for RocksDB resources, including predefined options, option 
factory and
  * shared resource among instances.
- * <p/>
- * This should be the only entrance for {@link RocksDBStateBackend} to get 
RocksDB options,
+ *
+ * <p>This should be the only entrance for {@link RocksDBStateBackend} to get 
RocksDB options,
  * and should be properly (and necessarily) closed to prevent resource leak.
  */
-public class RocksDBResourceContainer implements AutoCloseable {
+final class RocksDBResourceContainer implements AutoCloseable {
 
        /** The pre-configured option settings. */
        private PredefinedOptions predefinedOptions;
+
        /** The options factory to create the RocksDB options. */
+       @Nullable
        private OptionsFactory optionsFactory;
-       /** The shared resource among RocksDB instances. */
+
+       /** The shared resource among RocksDB instances. This resource is not 
part of the 'handlesToClose',
+        * because the handles to close are closed quietly, whereas for this 
one, we want exceptions to be reported. */
+       @Nullable
        private OpaqueMemoryResource<RocksDBSharedResources> sharedResources;
 
+       /** The handles to be closed when the container is closed. */
        private final ArrayList<AutoCloseable> handlesToClose;
 
        public RocksDBResourceContainer() {
@@ -71,7 +78,7 @@ public class RocksDBResourceContainer implements 
AutoCloseable {
        /**
         * Gets the RocksDB {@link ColumnFamilyOptions} to be used for all 
RocksDB instances.
         */
-       public ColumnFamilyOptions getColumnOptions() {
+       ColumnFamilyOptions getColumnOptions() {
                // initial options from pre-defined profile
                ColumnFamilyOptions opt = 
checkAndGetPredefinedOptions().createColumnOptions(handlesToClose);
 
@@ -83,10 +90,6 @@ public class RocksDBResourceContainer implements 
AutoCloseable {
                return opt;
        }
 
-       PredefinedOptions getPredefinedOptions() {
-               return predefinedOptions;
-       }
-
        PredefinedOptions checkAndGetPredefinedOptions() {
                if (predefinedOptions == null) {
                        predefinedOptions = PredefinedOptions.DEFAULT;

Reply via email to