[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
main
Yueh-Hsuan Chiang 11 years ago
parent 0365eaf12e
commit 3e701a654f
  1. 14
      java/org/rocksdb/RocksEnv.java

@ -22,11 +22,13 @@ public class RocksEnv extends RocksObject {
private static native long getDefaultEnvInternal(); private static native long getDefaultEnvInternal();
/** /**
* Returns a default environment suitable for the current operating * Returns the default environment suitable for the current operating
* system. * system.
* *
* The result of getDefault() belongs to rocksdb c++, and calling its * The result of getDefault() is a singleton whose ownership belongs
* dispose() will be no-op. * 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() { public static RocksEnv getDefault() {
return default_env_; return default_env_;
@ -71,8 +73,10 @@ public class RocksEnv extends RocksObject {
/** /**
* Package-private constructor that uses the specified native handle * Package-private constructor that uses the specified native handle
* to construct a RocksEnv. Note that the newly created RocksEnv * to construct a RocksEnv. Note that the ownership of the input handle
* will not take 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) { RocksEnv(long handle) {
super(); super();

Loading…
Cancel
Save