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

org.rocksdb.Env 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) 2011-present, 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;

/**
 * Base class for all Env implementations in RocksDB.
 */
public abstract class Env extends RocksObject {
  public static final int FLUSH_POOL = 0;
  public static final int COMPACTION_POOL = 1;

  /**
   * 

Returns the default environment suitable for the current operating * system.

* *

The result of {@code 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.

* * @return the default {@link org.rocksdb.RocksEnv} instance. */ public static Env getDefault() { return default_env_; } /** *

Sets the number of background worker threads of the flush pool * for this environment.

*

Default number: 1

* * @param num the number of threads * * @return current {@link RocksEnv} instance. */ public Env setBackgroundThreads(final int num) { return setBackgroundThreads(num, FLUSH_POOL); } /** *

Sets the number of background worker threads of the specified thread * pool for this environment.

* * @param num the number of threads * @param poolID the id to specified a thread pool. Should be either * FLUSH_POOL or COMPACTION_POOL. * *

Default number: 1

* @return current {@link RocksEnv} instance. */ public Env setBackgroundThreads(final int num, final int poolID) { setBackgroundThreads(nativeHandle_, num, poolID); return this; } /** *

Returns the length of the queue associated with the specified * thread pool.

* * @param poolID the id to specified a thread pool. Should be either * FLUSH_POOL or COMPACTION_POOL. * * @return the thread pool queue length. */ public int getThreadPoolQueueLen(final int poolID) { return getThreadPoolQueueLen(nativeHandle_, poolID); } protected Env(final long nativeHandle) { super(nativeHandle); } static { default_env_ = new RocksEnv(getDefaultEnvInternal()); } /** *

The static default Env. The ownership of its native handle * belongs to rocksdb c++ and is not able to be released on the Java * side.

*/ static Env default_env_; private static native long getDefaultEnvInternal(); private native void setBackgroundThreads( long handle, int num, int priority); private native int getThreadPoolQueueLen(long handle, int poolID); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy