Package org.rocksdb
Class ComparatorOptions
java.lang.Object
org.rocksdb.AbstractNativeReference
org.rocksdb.AbstractImmutableNativeReference
org.rocksdb.RocksObject
org.rocksdb.ComparatorOptions
- All Implemented Interfaces:
AutoCloseable
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 -
Method Summary
Modifier and TypeMethodDescriptionprotected final voiddisposeInternal(long handle) intMaximum size of a buffer (in bytes) that will be reused.Get the synchronisation type used to guard the reused buffers.setMaxReusedBufferSize(int maxReusedBufferSize) Sets the maximum size of a buffer (in bytes) that will be reused.setReusedSynchronisationType(ReusedSynchronisationType reusedSynchronisationType) Set the synchronisation type used to guard the reused buffers.setUseDirectBuffer(boolean useDirectBuffer) Controls whether a direct byte buffer (i.e.booleanIndicates if a direct byte buffer (i.e.Methods inherited from class org.rocksdb.RocksObject
disposeInternal, getNativeHandleMethods inherited from class org.rocksdb.AbstractImmutableNativeReference
close, disOwnNativeHandle, isOwningHandle
-
Constructor Details
-
ComparatorOptions
public ComparatorOptions()
-
-
Method Details
-
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 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
Controls whether a direct byte buffer (i.e. outside 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
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
-