Package org.rocksdb
Class Env
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
RocksEnv,RocksMemEnv,TimedEnv
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
Modifier and TypeMethodDescriptionintgetBackgroundThreads(Priority priority) Gets the number of background worker threads of the pool for this environment.static EnvReturns the default environment suitable for the current operating system.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.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.lowerThreadPoolCPUPriority(Priority priority) Lower CPU priority for threads from the specified pool.lowerThreadPoolIOPriority(Priority priority) Lower IO priority for threads from the specified pool.setBackgroundThreads(int number) Sets the number of background worker threads of the low priority pool for this environment.setBackgroundThreads(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, getNativeHandleMethods inherited from class org.rocksdb.AbstractImmutableNativeReference
close, disOwnNativeHandle, isOwningHandle
-
Method Details
-
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
Sets the number of background worker threads of the low priority pool for this environment.
Default number: 1
- Parameters:
number- the number of threads- Returns:
- current
RocksEnvinstance.
-
getBackgroundThreads
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
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
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
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
Lower IO priority for threads from the specified pool.- Parameters:
priority- the priority id of a specified thread pool.- Returns:
- current
RocksEnvinstance.
-
lowerThreadPoolCPUPriority
Lower CPU priority for threads from the specified pool.- Parameters:
priority- the priority id of a specified thread pool.- Returns:
- current
RocksEnvinstance.
-
getThreadList
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.
-