1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2 // This source code is licensed under both the GPLv2 (found in the
3 // COPYING file in the root directory) and Apache 2.0 License
4 // (found in the LICENSE.Apache file in the root directory).
9 * RocksObject is an implementation of {@link AbstractNativeReference} which
10 * has an immutable and therefore thread-safe reference to the underlying
11 * native C++ RocksDB object.
13 * RocksObject is the base-class of almost all RocksDB classes that have a
14 * pointer to some underlying native C++ {@code rocksdb} object.</p>
16 * The use of {@code RocksObject} should always be preferred over
17 * {@link RocksMutableObject}.</p>
19 public abstract class RocksObject
extends AbstractImmutableNativeReference
{
22 * An immutable reference to the value of the C++ pointer pointing to some
23 * underlying native RocksDB C++ object.
25 protected final long nativeHandle_
;
27 protected RocksObject(final long nativeHandle
) {
29 this.nativeHandle_
= nativeHandle
;
33 * Deletes underlying C++ object pointer.
36 protected void disposeInternal() {
37 disposeInternal(nativeHandle_
);
40 protected abstract void disposeInternal(final long handle
);
42 public long getNativeHandle() {