]> git.proxmox.com Git - ceph.git/blob - ceph/src/rocksdb/java/src/main/java/org/rocksdb/ComparatorOptions.java
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / rocksdb / java / src / main / java / org / rocksdb / ComparatorOptions.java
1 package org.rocksdb;
2
3 /**
4 * This class controls the behaviour
5 * of Java implementations of
6 * AbstractComparator
7 *
8 * Note that dispose() must be called before a ComparatorOptions
9 * instance becomes out-of-scope to release the allocated memory in C++.
10 */
11 public class ComparatorOptions extends RocksObject {
12 public ComparatorOptions() {
13 super(newComparatorOptions());
14 }
15
16 /**
17 * Use adaptive mutex, which spins in the user space before resorting
18 * to kernel. This could reduce context switch when the mutex is not
19 * heavily contended. However, if the mutex is hot, we could end up
20 * wasting spin time.
21 * Default: false
22 *
23 * @return true if adaptive mutex is used.
24 */
25 public boolean useAdaptiveMutex() {
26 assert(isOwningHandle());
27 return useAdaptiveMutex(nativeHandle_);
28 }
29
30 /**
31 * Use adaptive mutex, which spins in the user space before resorting
32 * to kernel. This could reduce context switch when the mutex is not
33 * heavily contended. However, if the mutex is hot, we could end up
34 * wasting spin time.
35 * Default: false
36 *
37 * @param useAdaptiveMutex true if adaptive mutex is used.
38 * @return the reference to the current comparator options.
39 */
40 public ComparatorOptions setUseAdaptiveMutex(final boolean useAdaptiveMutex) {
41 assert (isOwningHandle());
42 setUseAdaptiveMutex(nativeHandle_, useAdaptiveMutex);
43 return this;
44 }
45
46 private native static long newComparatorOptions();
47 private native boolean useAdaptiveMutex(final long handle);
48 private native void setUseAdaptiveMutex(final long handle,
49 final boolean useAdaptiveMutex);
50 @Override protected final native void disposeInternal(final long handle);
51 }