All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.rocksdb.RocksMutableObject Maven / Gradle / Ivy

Go to download

RocksDB fat jar to use with Apache Flink that contains .so files for linux32 and linux64, jnilib files for Mac OSX, and a .dll for Windows x64.

There is a newer version: 5.17.2-artisans-2.0
Show newest version
// Copyright (c) 2016, Facebook, Inc.  All rights reserved.
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.

package org.rocksdb;

/**
 * RocksMutableObject is an implementation of {@link AbstractNativeReference}
 * whose reference to the underlying native C++ object can change.
 *
 * 

The use of {@code RocksMutableObject} should be kept to a minimum, as it * has synchronization overheads and introduces complexity. Instead it is * recommended to use {@link RocksObject} where possible.

*/ public abstract class RocksMutableObject extends AbstractNativeReference { /** * An mutable reference to the value of the C++ pointer pointing to some * underlying native RocksDB C++ object. */ private long nativeHandle_; private boolean owningHandle_; protected RocksMutableObject() { } protected RocksMutableObject(final long nativeHandle) { this.nativeHandle_ = nativeHandle; this.owningHandle_ = true; } public synchronized void setNativeHandle(final long nativeHandle, final boolean owningNativeHandle) { this.nativeHandle_ = nativeHandle; this.owningHandle_ = owningNativeHandle; } @Override protected synchronized boolean isOwningHandle() { return this.owningHandle_; } /** * Gets the value of the C++ pointer pointing to the underlying * native C++ object * * @return the pointer value for the native object */ protected synchronized long getNativeHandle() { assert (this.nativeHandle_ != 0); return this.nativeHandle_; } @Override public synchronized final void close() { if (isOwningHandle()) { disposeInternal(); this.owningHandle_ = false; this.nativeHandle_ = 0; } } protected void disposeInternal() { disposeInternal(nativeHandle_); } protected abstract void disposeInternal(final long handle); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy