Package org.rocksdb
Class ComparatorOptions
- java.lang.Object
-
- org.rocksdb.AbstractNativeReference
-
- org.rocksdb.AbstractImmutableNativeReference
-
- org.rocksdb.RocksObject
-
- org.rocksdb.ComparatorOptions
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class ComparatorOptions extends RocksObject
This class controls the behaviour of Java implementations of AbstractComparator Note that dispose() must be called before a ComparatorOptions instance becomes out-of-scope to release the allocated memory in C++.
-
-
Field Summary
-
Fields inherited from class org.rocksdb.RocksObject
nativeHandle_
-
Fields inherited from class org.rocksdb.AbstractImmutableNativeReference
owningHandle_
-
-
Constructor Summary
Constructors Constructor Description ComparatorOptions()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddisposeInternal(long handle)intmaxReusedBufferSize()Maximum size of a buffer (in bytes) that will be reused.ReusedSynchronisationTypereusedSynchronisationType()Get the synchronisation type used to guard the reused buffers.ComparatorOptionssetMaxReusedBufferSize(int maxReusedBufferSize)Sets the maximum size of a buffer (in bytes) that will be reused.ComparatorOptionssetReusedSynchronisationType(ReusedSynchronisationType reusedSynchronisationType)Set the synchronisation type used to guard the reused buffers.ComparatorOptionssetUseDirectBuffer(boolean useDirectBuffer)Controls whether a direct byte buffer (i.e.booleanuseDirectBuffer()Indicates if a direct byte buffer (i.e.-
Methods inherited from class org.rocksdb.RocksObject
disposeInternal, getNativeHandle
-
Methods inherited from class org.rocksdb.AbstractImmutableNativeReference
close, disOwnNativeHandle, isOwningHandle
-
Methods inherited from class org.rocksdb.AbstractNativeReference
dispose, finalize
-
-
-
-
Method Detail
-
reusedSynchronisationType
public ReusedSynchronisationType reusedSynchronisationType()
Get the synchronisation type used to guard the reused buffers. Only used ifmaxReusedBufferSize()> 0 Default:ReusedSynchronisationType.ADAPTIVE_MUTEX- Returns:
- the synchronisation type
-
setReusedSynchronisationType
public ComparatorOptions setReusedSynchronisationType(ReusedSynchronisationType reusedSynchronisationType)
Set the synchronisation type used to guard the reused buffers. Only used ifmaxReusedBufferSize()> 0 Default:ReusedSynchronisationType.ADAPTIVE_MUTEX- Parameters:
reusedSynchronisationType- the synchronisation type- Returns:
- the reference to the current comparator options.
-
useDirectBuffer
public boolean useDirectBuffer()
Indicates if a direct byte buffer (i.e. outside of the normal garbage-collected heap) is used, as opposed to a non-direct byte buffer which is a wrapper around an on-heap byte[]. Default: true- Returns:
- true if a direct byte buffer will be used, false otherwise
-
setUseDirectBuffer
public ComparatorOptions setUseDirectBuffer(boolean useDirectBuffer)
Controls whether a direct byte buffer (i.e. outside of the normal garbage-collected heap) is used, as opposed to a non-direct byte buffer which is a wrapper around an on-heap byte[]. Default: true- Parameters:
useDirectBuffer- true if a direct byte buffer should be used, false otherwise- Returns:
- the reference to the current comparator options.
-
maxReusedBufferSize
public int maxReusedBufferSize()
Maximum size of a buffer (in bytes) that will be reused. Comparators will use 5 of these buffers, so the retained memory size will be 5 * max_reused_buffer_size. When a buffer is needed for transferring data to a callback, if it requires less thanmaxReuseBufferSize, then an existing buffer will be reused, else a new buffer will be allocated just for that callback. Default: 64 bytes- Returns:
- the maximum size of a buffer which is reused, or 0 if reuse is disabled
-
setMaxReusedBufferSize
public ComparatorOptions setMaxReusedBufferSize(int maxReusedBufferSize)
Sets the maximum size of a buffer (in bytes) that will be reused. Comparators will use 5 of these buffers, so the retained memory size will be 5 * max_reused_buffer_size. When a buffer is needed for transferring data to a callback, if it requires less thanmaxReuseBufferSize, then an existing buffer will be reused, else a new buffer will be allocated just for that callback. Default: 64 bytes- Parameters:
maxReusedBufferSize- the maximum size for a buffer to reuse, or 0 to disable reuse- Returns:
- the maximum size of a buffer which is reused
-
disposeInternal
protected final void disposeInternal(long handle)
- Specified by:
disposeInternalin classRocksObject
-
-