Package org.rocksdb
Class Env
- java.lang.Object
-
- All Implemented Interfaces:
java.lang.AutoCloseable
- Direct Known Subclasses:
HdfsEnv,RocksEnv,RocksMemEnv,TimedEnv
public abstract class Env extends RocksObject
Base class for all Env implementations in RocksDB.
-
-
Field Summary
-
Fields inherited from class org.rocksdb.RocksObject
nativeHandle_
-
Fields inherited from class org.rocksdb.AbstractImmutableNativeReference
owningHandle_
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetBackgroundThreads(Priority priority)Gets the number of background worker threads of the pool for this environment.static EnvgetDefault()Returns the default environment suitable for the current operating system.java.util.List<ThreadStatus>getThreadList()Returns the status of all threads that belong to the current Env.intgetThreadPoolQueueLen(Priority priority)Returns the length of the queue associated with the specified thread pool.EnvincBackgroundThreadsIfNeeded(int number, Priority priority)Enlarge number of background worker threads of a specific thread pool for this environment if it is smaller than specified.EnvlowerThreadPoolCPUPriority(Priority priority)Lower CPU priority for threads from the specified pool.EnvlowerThreadPoolIOPriority(Priority priority)Lower IO priority for threads from the specified pool.EnvsetBackgroundThreads(int number)Sets the number of background worker threads of the flush pool for this environment.EnvsetBackgroundThreads(int number, Priority priority)Sets the number of background worker threads of the specified thread pool for this environment.-
Methods inherited from class org.rocksdb.RocksObject
disposeInternal, disposeInternal, getNativeHandle
-
Methods inherited from class org.rocksdb.AbstractImmutableNativeReference
close, disOwnNativeHandle, isOwningHandle
-
Methods inherited from class org.rocksdb.AbstractNativeReference
dispose, finalize
-
-
-
-
Method Detail
-
getDefault
public static Env getDefault()
Returns the default environment suitable for the current operating system.
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()/close() will be no-op.- Returns:
- the default
RocksEnvinstance.
-
setBackgroundThreads
public Env setBackgroundThreads(int number)
Sets the number of background worker threads of the flush pool for this environment.
Default number: 1
- Parameters:
number- the number of threads- Returns:
- current
RocksEnvinstance.
-
getBackgroundThreads
public int getBackgroundThreads(Priority priority)
Gets the number of background worker threads of the pool for this environment.
- Parameters:
priority- the priority id of a specified thread pool.- Returns:
- the number of threads.
-
setBackgroundThreads
public Env setBackgroundThreads(int number, Priority priority)
Sets the number of background worker threads of the specified thread pool for this environment.
- Parameters:
number- the number of threadspriority- the priority id of a specified thread pool.Default number: 1
- Returns:
- current
RocksEnvinstance.
-
getThreadPoolQueueLen
public int getThreadPoolQueueLen(Priority priority)
Returns the length of the queue associated with the specified thread pool.
- Parameters:
priority- the priority id of a specified thread pool.- Returns:
- the thread pool queue length.
-
incBackgroundThreadsIfNeeded
public Env incBackgroundThreadsIfNeeded(int number, Priority priority)
Enlarge number of background worker threads of a specific thread pool for this environment if it is smaller than specified. 'LOW' is the default pool.- Parameters:
number- the number of threads.priority- the priority id of a specified thread pool.- Returns:
- current
RocksEnvinstance.
-
lowerThreadPoolIOPriority
public Env lowerThreadPoolIOPriority(Priority priority)
Lower IO priority for threads from the specified pool.- Parameters:
priority- the priority id of a specified thread pool.- Returns:
- current
RocksEnvinstance.
-
lowerThreadPoolCPUPriority
public Env lowerThreadPoolCPUPriority(Priority priority)
Lower CPU priority for threads from the specified pool.- Parameters:
priority- the priority id of a specified thread pool.- Returns:
- current
RocksEnvinstance.
-
getThreadList
public java.util.List<ThreadStatus> getThreadList() throws RocksDBException
Returns the status of all threads that belong to the current Env.- Returns:
- the status of all threads belong to this env.
- Throws:
RocksDBException- if the thread list cannot be acquired.
-
-