From 3e701a654f896200fbc7a70b175183c6e97292c4 Mon Sep 17 00:00:00 2001 From: Yueh-Hsuan Chiang Date: Sat, 7 Jun 2014 17:27:03 -0700 Subject: [PATCH] [Java] Improve documentation for RocksEnv and its C++ resource. Summary: Improve documentation for RocksEnv and its C++ resource. Specifically, the result of RocksEnv::Default() is a singleton, and the ownership of its c++ resource belongs to rocksdb c++. As a result, calling dispose() of the return value of RocksDB::Default() will be no-op. Test Plan: no code change. Reviewers: haobo, ankgup87 Reviewed By: ankgup87 Subscribers: leveldb Differential Revision: https://reviews.facebook.net/D18945 --- java/org/rocksdb/RocksEnv.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/java/org/rocksdb/RocksEnv.java b/java/org/rocksdb/RocksEnv.java index a9b1add4c..ce73ba654 100644 --- a/java/org/rocksdb/RocksEnv.java +++ b/java/org/rocksdb/RocksEnv.java @@ -22,11 +22,13 @@ public class RocksEnv extends RocksObject { private static native long getDefaultEnvInternal(); /** - * Returns a default environment suitable for the current operating + * Returns the default environment suitable for the current operating * system. * - * The result of getDefault() belongs to rocksdb c++, and calling its - * dispose() will be no-op. + * The result of getDefault() is a singleton whose ownership belongs + * to rocksdb c++. As a result, the returned RocksEnv will not + * have the ownership of its c++ resource, and calling its dispose() + * will be no-op. */ public static RocksEnv getDefault() { return default_env_; @@ -71,8 +73,10 @@ public class RocksEnv extends RocksObject { /** * Package-private constructor that uses the specified native handle - * to construct a RocksEnv. Note that the newly created RocksEnv - * will not take the ownership of the input handle. + * to construct a RocksEnv. Note that the ownership of the input handle + * belongs to the caller, and the newly created RocksEnv will not take + * the ownership of the input handle. As a result, calling dispose() + * of the created RocksEnv will be no-op. */ RocksEnv(long handle) { super();