Package org.rocksdb

Class Env

    • 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 RocksEnv instance.
      • 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 RocksEnv instance.
      • 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 threads
        priority - the priority id of a specified thread pool.

        Default number: 1

        Returns:
        current RocksEnv instance.
      • 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 RocksEnv instance.
      • 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 RocksEnv instance.
      • 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 RocksEnv instance.
      • 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.