Exposed IncreasedParallelism option to Java API as

setIncreasedParallelism
main
Adam Retter 10 years ago
parent 153f4f0719
commit eda0dcdd97
  1. 8
      java/org/rocksdb/DBOptions.java
  2. 15
      java/org/rocksdb/DBOptionsInterface.java
  3. 8
      java/org/rocksdb/Options.java
  4. 23
      java/rocksjni/options.cc

@ -72,6 +72,13 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
return dbOptions;
}
@Override
public DBOptions setIncreaseParallelism(int totalThreads) {
assert (isInitialized());
setIncreaseParallelism(nativeHandle_, totalThreads);
return this;
}
@Override
public DBOptions setCreateIfMissing(boolean flag) {
assert(isInitialized());
@ -547,6 +554,7 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
private native void newDBOptions();
private native void disposeInternal(long handle);
private native void setIncreaseParallelism(long handle, int totalThreads);
private native void setCreateIfMissing(long handle, boolean flag);
private native boolean createIfMissing(long handle);
private native void setCreateMissingColumnFamilies(

@ -7,6 +7,21 @@ package org.rocksdb;
public interface DBOptionsInterface {
/**
* <p>By default, RocksDB uses only one background thread for flush and
* compaction. Calling this function will set it up such that total of
* `total_threads` is used.</p>
*
* <p>You almost definitely want to call this function if your system is
* bottlenecked by RocksDB.</p>
*
* @param The total number of threads to be used by RocksDB. A good value
* is the number of cores.
*
* @return the instance of the current Options
*/
Object setIncreaseParallelism(int totalThreads);
/**
* If this value is set to true, then the database will be created
* if it is missing during {@code RocksDB.open()}.

@ -43,6 +43,13 @@ public class Options extends RocksObject
env_ = RocksEnv.getDefault();
}
@Override
public Options setIncreaseParallelism(int totalThreads) {
assert(isInitialized());
setIncreaseParallelism(nativeHandle_, totalThreads);
return this;
}
@Override
public Options setCreateIfMissing(boolean flag) {
assert(isInitialized());
@ -1032,6 +1039,7 @@ public class Options extends RocksObject
private native void prepareForBulkLoad(long handle);
// DB native handles
private native void setIncreaseParallelism(long handle, int totalThreads);
private native void setCreateIfMissing(long handle, boolean flag);
private native boolean createIfMissing(long handle);
private native void setCreateMissingColumnFamilies(

@ -68,6 +68,17 @@ void Java_org_rocksdb_Options_disposeInternal(
delete reinterpret_cast<rocksdb::Options*>(handle);
}
/*
* Class: org_rocksdb_Options
* Method: setIncreaseParallelism
* Signature: (JI)V
*/
void Java_org_rocksdb_Options_setIncreaseParallelism(
JNIEnv * evnv, jobject jobj, jlong jhandle, jint totalThreads) {
reinterpret_cast<rocksdb::Options*>
(jhandle)->IncreaseParallelism(static_cast<int>(totalThreads));
}
/*
* Class: org_rocksdb_Options
* Method: setCreateIfMissing
@ -2816,6 +2827,18 @@ void Java_org_rocksdb_DBOptions_disposeInternal(
delete reinterpret_cast<rocksdb::DBOptions*>(handle);
}
/*
* Class: org_rocksdb_DBOptions
* Method: setIncreaseParallelism
* Signature: (JI)V
*/
void Java_org_rocksdb_DBOptions_setIncreaseParallelism(
JNIEnv * env, jobject jobj, jlong jhandle, jint totalThreads) {
reinterpret_cast<rocksdb::DBOptions*>
(jhandle)->IncreaseParallelism(static_cast<int>(totalThreads));
}
/*
* Class: org_rocksdb_DBOptions
* Method: setCreateIfMissing

Loading…
Cancel
Save