[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 10 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();
/**
* 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();

Loading…
Cancel
Save