[RocksJava] Final usage correction

Summary:
Introduced final keyword to parameters with immutable values and classes
which should not be derived.

Test Plan:
make rocksdbjava
make jtest

Reviewers: yhchiang, adamretter, ankgup87

Subscribers: dhruba

Differential Revision: https://reviews.facebook.net/D33417
This commit is contained in:
fyrz 2015-02-13 21:30:08 +01:00
parent 5139e678b0
commit 819e787bb9
38 changed files with 487 additions and 389 deletions

View File

@ -23,7 +23,8 @@ public abstract class AbstractRocksIterator<P extends RocksObject>
extends RocksObject implements RocksIteratorInterface {
final P parent_;
protected AbstractRocksIterator(P parent, long nativeHandle) {
protected AbstractRocksIterator(final P parent,
final long nativeHandle) {
super();
nativeHandle_ = nativeHandle;
// parent must point to a valid RocksDB instance.

View File

@ -8,7 +8,7 @@ package org.rocksdb;
* Instances of this class describe a Backup made by
* {@link org.rocksdb.BackupableDB}.
*/
public class BackupInfo {
public final class BackupInfo {
/**
* Package private constructor used to create instances
@ -20,8 +20,8 @@ public class BackupInfo {
* @param size size of backup
* @param numberFiles number of files related to this backup.
*/
BackupInfo(int backupId, long timestamp, long size,
int numberFiles) {
BackupInfo(final int backupId, final long timestamp, final long size,
final int numberFiles) {
backupId_ = backupId;
timestamp_ = timestamp;
size_ = size;

View File

@ -13,7 +13,7 @@ import java.util.List;
*
* @see org.rocksdb.BackupableDBOptions
*/
public class BackupableDB extends RocksDB {
public final class BackupableDB extends RocksDB {
/**
* <p>Open a {@code BackupableDB} under the specified path.
* Note that the backup path should be set properly in the
@ -30,7 +30,7 @@ public class BackupableDB extends RocksDB {
* native library.
*/
public static BackupableDB open(
Options opt, BackupableDBOptions bopt, String db_path)
final Options opt, final BackupableDBOptions bopt, final String db_path)
throws RocksDBException {
RocksDB db = RocksDB.open(opt, db_path);
@ -54,7 +54,7 @@ public class BackupableDB extends RocksDB {
* @throws RocksDBException thrown if error happens in underlying
* native library.
*/
public void createNewBackup(boolean flushBeforeBackup)
public void createNewBackup(final boolean flushBeforeBackup)
throws RocksDBException {
assert(isInitialized());
createNewBackup(nativeHandle_, flushBeforeBackup);
@ -68,7 +68,7 @@ public class BackupableDB extends RocksDB {
* @throws RocksDBException thrown if error happens in underlying
* native library.
*/
public void purgeOldBackups(int numBackupsToKeep)
public void purgeOldBackups(final int numBackupsToKeep)
throws RocksDBException {
assert(isInitialized());
purgeOldBackups(nativeHandle_, numBackupsToKeep);
@ -82,7 +82,7 @@ public class BackupableDB extends RocksDB {
* @throws RocksDBException thrown if error happens in underlying
* native library.
*/
public void deleteBackup(int backupId) throws RocksDBException {
public void deleteBackup(final int backupId) throws RocksDBException {
assert(isInitialized());
deleteBackup0(nativeHandle_, backupId);
}

View File

@ -17,7 +17,7 @@ import java.nio.file.Path;
*
* @see org.rocksdb.BackupableDB
*/
public class BackupableDBOptions extends RocksObject {
public final class BackupableDBOptions extends RocksObject {
/**
* <p>BackupableDBOptions constructor.</p>
@ -26,7 +26,7 @@ public class BackupableDBOptions extends RocksObject {
* Best to set this to {@code db name_ + "/backups"}
* @throws java.lang.IllegalArgumentException if illegal path is used.
*/
public BackupableDBOptions(String path) {
public BackupableDBOptions(final String path) {
super();
File backupPath = path == null ? null : new File(path);
if (backupPath == null || !backupPath.isDirectory() || !backupPath.canWrite()) {
@ -57,7 +57,7 @@ public class BackupableDBOptions extends RocksObject {
*
* @return instance of current BackupableDBOptions.
*/
public BackupableDBOptions setShareTableFiles(boolean shareTableFiles) {
public BackupableDBOptions setShareTableFiles(final boolean shareTableFiles) {
assert(isInitialized());
setShareTableFiles(nativeHandle_, shareTableFiles);
return this;
@ -86,7 +86,7 @@ public class BackupableDBOptions extends RocksObject {
*
* @return instance of current BackupableDBOptions.
*/
public BackupableDBOptions setSync(boolean sync) {
public BackupableDBOptions setSync(final boolean sync) {
assert(isInitialized());
setSync(nativeHandle_, sync);
return this;
@ -111,7 +111,7 @@ public class BackupableDBOptions extends RocksObject {
*
* @return instance of current BackupableDBOptions.
*/
public BackupableDBOptions setDestroyOldData(boolean destroyOldData) {
public BackupableDBOptions setDestroyOldData(final boolean destroyOldData) {
assert(isInitialized());
setDestroyOldData(nativeHandle_, destroyOldData);
return this;
@ -138,7 +138,7 @@ public class BackupableDBOptions extends RocksObject {
*
* @return instance of current BackupableDBOptions.
*/
public BackupableDBOptions setBackupLogFiles(boolean backupLogFiles) {
public BackupableDBOptions setBackupLogFiles(final boolean backupLogFiles) {
assert(isInitialized());
setBackupLogFiles(nativeHandle_, backupLogFiles);
return this;
@ -226,7 +226,7 @@ public class BackupableDBOptions extends RocksObject {
* @return instance of current BackupableDBOptions.
*/
public BackupableDBOptions setShareFilesWithChecksum(
boolean shareFilesWithChecksum) {
final boolean shareFilesWithChecksum) {
assert(isInitialized());
setShareFilesWithChecksum(nativeHandle_, shareFilesWithChecksum);
return this;

View File

@ -9,7 +9,7 @@ package org.rocksdb;
*
* BlockBasedTable is a RocksDB's default SST file format.
*/
public class BlockBasedTableConfig extends TableFormatConfig {
public final class BlockBasedTableConfig extends TableFormatConfig {
public BlockBasedTableConfig() {
noBlockCache_ = false;
@ -38,7 +38,7 @@ public class BlockBasedTableConfig extends TableFormatConfig {
* @param noBlockCache if use block cache
* @return the reference to the current config.
*/
public BlockBasedTableConfig setNoBlockCache(boolean noBlockCache) {
public BlockBasedTableConfig setNoBlockCache(final boolean noBlockCache) {
noBlockCache_ = noBlockCache;
return this;
}
@ -58,7 +58,7 @@ public class BlockBasedTableConfig extends TableFormatConfig {
* @param blockCacheSize block cache size in bytes
* @return the reference to the current config.
*/
public BlockBasedTableConfig setBlockCacheSize(long blockCacheSize) {
public BlockBasedTableConfig setBlockCacheSize(final long blockCacheSize) {
blockCacheSize_ = blockCacheSize;
return this;
}
@ -79,7 +79,8 @@ public class BlockBasedTableConfig extends TableFormatConfig {
* number means use default settings."
* @return the reference to the current option.
*/
public BlockBasedTableConfig setCacheNumShardBits(int blockCacheNumShardBits) {
public BlockBasedTableConfig setCacheNumShardBits(
final int blockCacheNumShardBits) {
blockCacheNumShardBits_ = blockCacheNumShardBits;
return this;
}
@ -105,7 +106,7 @@ public class BlockBasedTableConfig extends TableFormatConfig {
* @param blockSize block size in bytes
* @return the reference to the current config.
*/
public BlockBasedTableConfig setBlockSize(long blockSize) {
public BlockBasedTableConfig setBlockSize(final long blockSize) {
blockSize_ = blockSize;
return this;
}
@ -128,7 +129,8 @@ public class BlockBasedTableConfig extends TableFormatConfig {
* @param blockSizeDeviation the deviation to block size allowed
* @return the reference to the current config.
*/
public BlockBasedTableConfig setBlockSizeDeviation(int blockSizeDeviation) {
public BlockBasedTableConfig setBlockSizeDeviation(
final int blockSizeDeviation) {
blockSizeDeviation_ = blockSizeDeviation;
return this;
}
@ -146,7 +148,8 @@ public class BlockBasedTableConfig extends TableFormatConfig {
* @param restartInterval block restart interval.
* @return the reference to the current config.
*/
public BlockBasedTableConfig setBlockRestartInterval(int restartInterval) {
public BlockBasedTableConfig setBlockRestartInterval(
final int restartInterval) {
blockRestartInterval_ = restartInterval;
return this;
}
@ -166,7 +169,8 @@ public class BlockBasedTableConfig extends TableFormatConfig {
* @param wholeKeyFiltering if enable whole key filtering
* @return the reference to the current config.
*/
public BlockBasedTableConfig setWholeKeyFiltering(boolean wholeKeyFiltering) {
public BlockBasedTableConfig setWholeKeyFiltering(
final boolean wholeKeyFiltering) {
wholeKeyFiltering_ = wholeKeyFiltering;
return this;
}
@ -191,7 +195,8 @@ public class BlockBasedTableConfig extends TableFormatConfig {
* @param filter {@link org.rocksdb.Filter} Filter Policy java instance.
* @return the reference to the current config.
*/
public BlockBasedTableConfig setFilter(Filter filter) {
public BlockBasedTableConfig setFilter(
final Filter filter) {
filter_ = filter;
return this;
}
@ -216,7 +221,7 @@ public class BlockBasedTableConfig extends TableFormatConfig {
* @return the reference to the current config.
*/
public BlockBasedTableConfig setCacheIndexAndFilterBlocks(
boolean cacheIndexAndFilterBlocks) {
final boolean cacheIndexAndFilterBlocks) {
cacheIndexAndFilterBlocks_ = cacheIndexAndFilterBlocks;
return this;
}
@ -243,7 +248,7 @@ public class BlockBasedTableConfig extends TableFormatConfig {
* @return the reference to the current config.
*/
public BlockBasedTableConfig setHashIndexAllowCollision(
boolean hashIndexAllowCollision) {
final boolean hashIndexAllowCollision) {
hashIndexAllowCollision_ = hashIndexAllowCollision;
return this;
}
@ -266,7 +271,7 @@ public class BlockBasedTableConfig extends TableFormatConfig {
* @return the reference to the current config.
*/
public BlockBasedTableConfig setBlockCacheCompressedSize(
long blockCacheCompressedSize) {
final long blockCacheCompressedSize) {
blockCacheCompressedSize_ = blockCacheCompressedSize;
return this;
}
@ -293,7 +298,7 @@ public class BlockBasedTableConfig extends TableFormatConfig {
* @return the reference to the current option.
*/
public BlockBasedTableConfig setBlockCacheCompressedNumShardBits(
int blockCacheCompressedNumShardBits) {
final int blockCacheCompressedNumShardBits) {
blockCacheCompressedNumShardBits_ = blockCacheCompressedNumShardBits;
return this;
}
@ -304,7 +309,8 @@ public class BlockBasedTableConfig extends TableFormatConfig {
* @param checksumType {@link org.rocksdb.ChecksumType} value.
* @return the reference to the current option.
*/
public BlockBasedTableConfig setChecksumType(ChecksumType checksumType) {
public BlockBasedTableConfig setChecksumType(
final ChecksumType checksumType) {
checksumType_ = checksumType;
return this;
}
@ -323,7 +329,8 @@ public class BlockBasedTableConfig extends TableFormatConfig {
* @param indexType {@link org.rocksdb.IndexType} value
* @return the reference to the current option.
*/
public BlockBasedTableConfig setIndexType(IndexType indexType) {
public BlockBasedTableConfig setIndexType(
final IndexType indexType) {
indexType_ = indexType;
return this;
}
@ -358,7 +365,8 @@ public class BlockBasedTableConfig extends TableFormatConfig {
* @param formatVersion integer representing the version to be used.
* @return the reference to the current option.
*/
public BlockBasedTableConfig setFormatVersion(int formatVersion) {
public BlockBasedTableConfig setFormatVersion(
final int formatVersion) {
assert(formatVersion >= 0 && formatVersion <= 2);
formatVersion_ = formatVersion;
return this;

View File

@ -18,7 +18,7 @@ package org.rocksdb;
* FilterPolicy (like {@code BloomFilter}) that does not ignore
* trailing spaces in keys.</p>
*/
public class BloomFilter extends Filter {
public final class BloomFilter extends Filter {
private static final int DEFAULT_BITS_PER_KEY = 10;
private static final boolean DEFAULT_MODE = true;
@ -49,7 +49,7 @@ public class BloomFilter extends Filter {
*
* @param bitsPerKey number of bits to use
*/
public BloomFilter(int bitsPerKey) {
public BloomFilter(final int bitsPerKey) {
this(bitsPerKey, DEFAULT_MODE);
}
@ -72,7 +72,7 @@ public class BloomFilter extends Filter {
* @param bitsPerKey number of bits to use
* @param useBlockBasedMode use block based mode or full filter mode
*/
public BloomFilter(int bitsPerKey, boolean useBlockBasedMode) {
public BloomFilter(final int bitsPerKey, final boolean useBlockBasedMode) {
super();
bitsPerKey_ = bitsPerKey;
useBlockBasedMode_ = useBlockBasedMode;
@ -80,7 +80,7 @@ public class BloomFilter extends Filter {
}
@Override
protected void createNewFilter() {
protected final void createNewFilter() {
createNewBloomFilter(bitsPerKey_, useBlockBasedMode_);
}

View File

@ -9,7 +9,7 @@ package org.rocksdb;
* Provides Checkpoint functionality. Checkpoints
* provide persistent snapshots of RocksDB databases.
*/
public class Checkpoint extends RocksObject {
public final class Checkpoint extends RocksObject {
/**
* Creates a Checkpoint object to be used for creating open-able
@ -23,7 +23,7 @@ public class Checkpoint extends RocksObject {
* @throws java.lang.IllegalStateException if {@link RocksDB}
* instance is not initialized.
*/
public static Checkpoint create(RocksDB db) {
public static Checkpoint create(final RocksDB db) {
if (db == null) {
throw new IllegalArgumentException(
"RocksDB instance shall not be null.");
@ -46,7 +46,7 @@ public class Checkpoint extends RocksObject {
* @throws RocksDBException thrown if an error occurs within the native
* part of the library.
*/
public void createCheckpoint(String checkpointPath)
public void createCheckpoint(final String checkpointPath)
throws RocksDBException {
createCheckpoint(nativeHandle_, checkpointPath);
}
@ -62,7 +62,7 @@ public class Checkpoint extends RocksObject {
db_ = db;
}
RocksDB db_;
private RocksDB db_;
private static native long newCheckpoint(long dbHandle);
private native void disposeInternal(long handle);

View File

@ -9,7 +9,7 @@ package org.rocksdb;
* <p>Describes a column family with a
* name and respective Options.</p>
*/
public class ColumnFamilyDescriptor {
public final class ColumnFamilyDescriptor {
/**
* <p>Creates a new Column Family using a name and default

View File

@ -9,8 +9,9 @@ package org.rocksdb;
* ColumnFamilyHandle class to hold handles to underlying rocksdb
* ColumnFamily Pointers.
*/
public class ColumnFamilyHandle extends RocksObject {
ColumnFamilyHandle(RocksDB rocksDB, long nativeHandle) {
public final class ColumnFamilyHandle extends RocksObject {
ColumnFamilyHandle(final RocksDB rocksDB,
final long nativeHandle) {
super();
nativeHandle_ = nativeHandle;
// rocksDB must point to a valid RocksDB instance;

View File

@ -14,7 +14,7 @@ import java.util.Properties;
* If {@link #dispose()} function is not called, then it will be GC'd automatically
* and native resources will be released as part of the process.
*/
public class ColumnFamilyOptions extends RocksObject
public final class ColumnFamilyOptions extends RocksObject
implements ColumnFamilyOptionsInterface {
static {
RocksDB.loadLibrary();
@ -51,7 +51,7 @@ public class ColumnFamilyOptions extends RocksObject
* {@link Properties} instance is passed to the method call.
*/
public static ColumnFamilyOptions getColumnFamilyOptionsFromProps(
Properties properties) {
final Properties properties) {
if (properties == null || properties.size() == 0) {
throw new IllegalArgumentException(
"Properties value must contain at least one value.");
@ -74,7 +74,7 @@ public class ColumnFamilyOptions extends RocksObject
@Override
public ColumnFamilyOptions optimizeForPointLookup(
long blockCacheSizeMb) {
final long blockCacheSizeMb) {
optimizeForPointLookup(nativeHandle_,
blockCacheSizeMb);
return this;
@ -89,7 +89,7 @@ public class ColumnFamilyOptions extends RocksObject
@Override
public ColumnFamilyOptions optimizeLevelStyleCompaction(
long memtableMemoryBudget) {
final long memtableMemoryBudget) {
optimizeLevelStyleCompaction(nativeHandle_,
memtableMemoryBudget);
return this;
@ -104,14 +104,14 @@ public class ColumnFamilyOptions extends RocksObject
@Override
public ColumnFamilyOptions optimizeUniversalStyleCompaction(
long memtableMemoryBudget) {
final long memtableMemoryBudget) {
optimizeUniversalStyleCompaction(nativeHandle_,
memtableMemoryBudget);
return this;
}
@Override
public ColumnFamilyOptions setComparator(BuiltinComparator builtinComparator) {
public ColumnFamilyOptions setComparator(final BuiltinComparator builtinComparator) {
assert(isInitialized());
setComparatorHandle(nativeHandle_, builtinComparator.ordinal());
return this;
@ -119,7 +119,7 @@ public class ColumnFamilyOptions extends RocksObject
@Override
public ColumnFamilyOptions setComparator(
AbstractComparator<? extends AbstractSlice<?>> comparator) {
final AbstractComparator<? extends AbstractSlice<?>> comparator) {
assert (isInitialized());
setComparatorHandle(nativeHandle_, comparator.nativeHandle_);
comparator_ = comparator;
@ -127,7 +127,7 @@ public class ColumnFamilyOptions extends RocksObject
}
@Override
public ColumnFamilyOptions setMergeOperatorName(String name) {
public ColumnFamilyOptions setMergeOperatorName(final String name) {
assert (isInitialized());
if (name == null) {
throw new IllegalArgumentException(
@ -138,13 +138,13 @@ public class ColumnFamilyOptions extends RocksObject
}
@Override
public ColumnFamilyOptions setMergeOperator(MergeOperator mergeOperator) {
public ColumnFamilyOptions setMergeOperator(final MergeOperator mergeOperator) {
setMergeOperator(nativeHandle_, mergeOperator.newMergeOperatorHandle());
return this;
}
@Override
public ColumnFamilyOptions setWriteBufferSize(long writeBufferSize)
public ColumnFamilyOptions setWriteBufferSize(final long writeBufferSize)
throws RocksDBException {
assert(isInitialized());
setWriteBufferSize(nativeHandle_, writeBufferSize);
@ -159,7 +159,7 @@ public class ColumnFamilyOptions extends RocksObject
@Override
public ColumnFamilyOptions setMaxWriteBufferNumber(
int maxWriteBufferNumber) {
final int maxWriteBufferNumber) {
assert(isInitialized());
setMaxWriteBufferNumber(nativeHandle_, maxWriteBufferNumber);
return this;
@ -173,7 +173,7 @@ public class ColumnFamilyOptions extends RocksObject
@Override
public ColumnFamilyOptions setMinWriteBufferNumberToMerge(
int minWriteBufferNumberToMerge) {
final int minWriteBufferNumberToMerge) {
setMinWriteBufferNumberToMerge(nativeHandle_, minWriteBufferNumberToMerge);
return this;
}
@ -184,14 +184,14 @@ public class ColumnFamilyOptions extends RocksObject
}
@Override
public ColumnFamilyOptions useFixedLengthPrefixExtractor(int n) {
public ColumnFamilyOptions useFixedLengthPrefixExtractor(final int n) {
assert(isInitialized());
useFixedLengthPrefixExtractor(nativeHandle_, n);
return this;
}
@Override
public ColumnFamilyOptions setCompressionType(CompressionType compressionType) {
public ColumnFamilyOptions setCompressionType(final CompressionType compressionType) {
setCompressionType(nativeHandle_, compressionType.getValue());
return this;
}
@ -202,7 +202,7 @@ public class ColumnFamilyOptions extends RocksObject
}
@Override
public ColumnFamilyOptions setNumLevels(int numLevels) {
public ColumnFamilyOptions setNumLevels(final int numLevels) {
setNumLevels(nativeHandle_, numLevels);
return this;
}
@ -214,7 +214,7 @@ public class ColumnFamilyOptions extends RocksObject
@Override
public ColumnFamilyOptions setLevelZeroFileNumCompactionTrigger(
int numFiles) {
final int numFiles) {
setLevelZeroFileNumCompactionTrigger(
nativeHandle_, numFiles);
return this;
@ -227,7 +227,7 @@ public class ColumnFamilyOptions extends RocksObject
@Override
public ColumnFamilyOptions setLevelZeroSlowdownWritesTrigger(
int numFiles) {
final int numFiles) {
setLevelZeroSlowdownWritesTrigger(nativeHandle_, numFiles);
return this;
}
@ -238,7 +238,7 @@ public class ColumnFamilyOptions extends RocksObject
}
@Override
public ColumnFamilyOptions setLevelZeroStopWritesTrigger(int numFiles) {
public ColumnFamilyOptions setLevelZeroStopWritesTrigger(final int numFiles) {
setLevelZeroStopWritesTrigger(nativeHandle_, numFiles);
return this;
}
@ -250,7 +250,7 @@ public class ColumnFamilyOptions extends RocksObject
@Override
public ColumnFamilyOptions setMaxMemCompactionLevel(
int maxMemCompactionLevel) {
final int maxMemCompactionLevel) {
setMaxMemCompactionLevel(nativeHandle_, maxMemCompactionLevel);
return this;
}
@ -261,7 +261,8 @@ public class ColumnFamilyOptions extends RocksObject
}
@Override
public ColumnFamilyOptions setTargetFileSizeBase(long targetFileSizeBase) {
public ColumnFamilyOptions setTargetFileSizeBase(
final long targetFileSizeBase) {
setTargetFileSizeBase(nativeHandle_, targetFileSizeBase);
return this;
}
@ -272,7 +273,8 @@ public class ColumnFamilyOptions extends RocksObject
}
@Override
public ColumnFamilyOptions setTargetFileSizeMultiplier(int multiplier) {
public ColumnFamilyOptions setTargetFileSizeMultiplier(
final int multiplier) {
setTargetFileSizeMultiplier(nativeHandle_, multiplier);
return this;
}
@ -284,7 +286,7 @@ public class ColumnFamilyOptions extends RocksObject
@Override
public ColumnFamilyOptions setMaxBytesForLevelBase(
long maxBytesForLevelBase) {
final long maxBytesForLevelBase) {
setMaxBytesForLevelBase(nativeHandle_, maxBytesForLevelBase);
return this;
}
@ -295,7 +297,8 @@ public class ColumnFamilyOptions extends RocksObject
}
@Override
public ColumnFamilyOptions setMaxBytesForLevelMultiplier(int multiplier) {
public ColumnFamilyOptions setMaxBytesForLevelMultiplier(
final int multiplier) {
setMaxBytesForLevelMultiplier(nativeHandle_, multiplier);
return this;
}
@ -306,7 +309,8 @@ public class ColumnFamilyOptions extends RocksObject
}
@Override
public ColumnFamilyOptions setExpandedCompactionFactor(int expandedCompactionFactor) {
public ColumnFamilyOptions setExpandedCompactionFactor(
final int expandedCompactionFactor) {
setExpandedCompactionFactor(nativeHandle_, expandedCompactionFactor);
return this;
}
@ -317,7 +321,8 @@ public class ColumnFamilyOptions extends RocksObject
}
@Override
public ColumnFamilyOptions setSourceCompactionFactor(int sourceCompactionFactor) {
public ColumnFamilyOptions setSourceCompactionFactor(
final int sourceCompactionFactor) {
setSourceCompactionFactor(nativeHandle_, sourceCompactionFactor);
return this;
}
@ -329,7 +334,7 @@ public class ColumnFamilyOptions extends RocksObject
@Override
public ColumnFamilyOptions setMaxGrandparentOverlapFactor(
int maxGrandparentOverlapFactor) {
final int maxGrandparentOverlapFactor) {
setMaxGrandparentOverlapFactor(nativeHandle_, maxGrandparentOverlapFactor);
return this;
}
@ -340,7 +345,8 @@ public class ColumnFamilyOptions extends RocksObject
}
@Override
public ColumnFamilyOptions setSoftRateLimit(double softRateLimit) {
public ColumnFamilyOptions setSoftRateLimit(
final double softRateLimit) {
setSoftRateLimit(nativeHandle_, softRateLimit);
return this;
}
@ -351,7 +357,8 @@ public class ColumnFamilyOptions extends RocksObject
}
@Override
public ColumnFamilyOptions setHardRateLimit(double hardRateLimit) {
public ColumnFamilyOptions setHardRateLimit(
final double hardRateLimit) {
setHardRateLimit(nativeHandle_, hardRateLimit);
return this;
}
@ -363,7 +370,7 @@ public class ColumnFamilyOptions extends RocksObject
@Override
public ColumnFamilyOptions setRateLimitDelayMaxMilliseconds(
int rateLimitDelayMaxMilliseconds) {
final int rateLimitDelayMaxMilliseconds) {
setRateLimitDelayMaxMilliseconds(
nativeHandle_, rateLimitDelayMaxMilliseconds);
return this;
@ -375,7 +382,8 @@ public class ColumnFamilyOptions extends RocksObject
}
@Override
public ColumnFamilyOptions setArenaBlockSize(long arenaBlockSize)
public ColumnFamilyOptions setArenaBlockSize(
final long arenaBlockSize)
throws RocksDBException {
setArenaBlockSize(nativeHandle_, arenaBlockSize);
return this;
@ -387,7 +395,8 @@ public class ColumnFamilyOptions extends RocksObject
}
@Override
public ColumnFamilyOptions setDisableAutoCompactions(boolean disableAutoCompactions) {
public ColumnFamilyOptions setDisableAutoCompactions(
final boolean disableAutoCompactions) {
setDisableAutoCompactions(nativeHandle_, disableAutoCompactions);
return this;
}
@ -399,7 +408,7 @@ public class ColumnFamilyOptions extends RocksObject
@Override
public ColumnFamilyOptions setPurgeRedundantKvsWhileFlush(
boolean purgeRedundantKvsWhileFlush) {
final boolean purgeRedundantKvsWhileFlush) {
setPurgeRedundantKvsWhileFlush(
nativeHandle_, purgeRedundantKvsWhileFlush);
return this;
@ -411,7 +420,8 @@ public class ColumnFamilyOptions extends RocksObject
}
@Override
public ColumnFamilyOptions setCompactionStyle(CompactionStyle compactionStyle) {
public ColumnFamilyOptions setCompactionStyle(
final CompactionStyle compactionStyle) {
setCompactionStyle(nativeHandle_, compactionStyle.getValue());
return this;
}
@ -423,7 +433,7 @@ public class ColumnFamilyOptions extends RocksObject
@Override
public ColumnFamilyOptions setVerifyChecksumsInCompaction(
boolean verifyChecksumsInCompaction) {
final boolean verifyChecksumsInCompaction) {
setVerifyChecksumsInCompaction(
nativeHandle_, verifyChecksumsInCompaction);
return this;
@ -435,7 +445,8 @@ public class ColumnFamilyOptions extends RocksObject
}
@Override
public ColumnFamilyOptions setFilterDeletes(boolean filterDeletes) {
public ColumnFamilyOptions setFilterDeletes(
final boolean filterDeletes) {
setFilterDeletes(nativeHandle_, filterDeletes);
return this;
}
@ -446,7 +457,8 @@ public class ColumnFamilyOptions extends RocksObject
}
@Override
public ColumnFamilyOptions setMaxSequentialSkipInIterations(long maxSequentialSkipInIterations) {
public ColumnFamilyOptions setMaxSequentialSkipInIterations(
final long maxSequentialSkipInIterations) {
setMaxSequentialSkipInIterations(nativeHandle_, maxSequentialSkipInIterations);
return this;
}
@ -457,8 +469,8 @@ public class ColumnFamilyOptions extends RocksObject
}
@Override
public ColumnFamilyOptions setMemTableConfig(MemTableConfig config)
throws RocksDBException {
public ColumnFamilyOptions setMemTableConfig(
final MemTableConfig config) throws RocksDBException {
memTableConfig_ = config;
setMemTableFactory(nativeHandle_, config.newMemTableFactoryHandle());
return this;
@ -471,7 +483,8 @@ public class ColumnFamilyOptions extends RocksObject
}
@Override
public ColumnFamilyOptions setTableFormatConfig(TableFormatConfig config) {
public ColumnFamilyOptions setTableFormatConfig(
final TableFormatConfig config) {
tableFormatConfig_ = config;
setTableFactory(nativeHandle_, config.newTableFactoryHandle());
return this;
@ -484,7 +497,8 @@ public class ColumnFamilyOptions extends RocksObject
}
@Override
public ColumnFamilyOptions setInplaceUpdateSupport(boolean inplaceUpdateSupport) {
public ColumnFamilyOptions setInplaceUpdateSupport(
final boolean inplaceUpdateSupport) {
setInplaceUpdateSupport(nativeHandle_, inplaceUpdateSupport);
return this;
}
@ -495,7 +509,8 @@ public class ColumnFamilyOptions extends RocksObject
}
@Override
public ColumnFamilyOptions setInplaceUpdateNumLocks(long inplaceUpdateNumLocks)
public ColumnFamilyOptions setInplaceUpdateNumLocks(
final long inplaceUpdateNumLocks)
throws RocksDBException {
setInplaceUpdateNumLocks(nativeHandle_, inplaceUpdateNumLocks);
return this;
@ -507,7 +522,8 @@ public class ColumnFamilyOptions extends RocksObject
}
@Override
public ColumnFamilyOptions setMemtablePrefixBloomBits(int memtablePrefixBloomBits) {
public ColumnFamilyOptions setMemtablePrefixBloomBits(
final int memtablePrefixBloomBits) {
setMemtablePrefixBloomBits(nativeHandle_, memtablePrefixBloomBits);
return this;
}
@ -518,7 +534,8 @@ public class ColumnFamilyOptions extends RocksObject
}
@Override
public ColumnFamilyOptions setMemtablePrefixBloomProbes(int memtablePrefixBloomProbes) {
public ColumnFamilyOptions setMemtablePrefixBloomProbes(
final int memtablePrefixBloomProbes) {
setMemtablePrefixBloomProbes(nativeHandle_, memtablePrefixBloomProbes);
return this;
}
@ -540,8 +557,8 @@ public class ColumnFamilyOptions extends RocksObject
}
@Override
public ColumnFamilyOptions setMaxSuccessiveMerges(long maxSuccessiveMerges)
throws RocksDBException {
public ColumnFamilyOptions setMaxSuccessiveMerges(
final long maxSuccessiveMerges) throws RocksDBException {
setMaxSuccessiveMerges(nativeHandle_, maxSuccessiveMerges);
return this;
}
@ -552,7 +569,8 @@ public class ColumnFamilyOptions extends RocksObject
}
@Override
public ColumnFamilyOptions setMinPartialMergeOperands(int minPartialMergeOperands) {
public ColumnFamilyOptions setMinPartialMergeOperands(
final int minPartialMergeOperands) {
setMinPartialMergeOperands(nativeHandle_, minPartialMergeOperands);
return this;
}
@ -577,7 +595,7 @@ public class ColumnFamilyOptions extends RocksObject
*
* @param handle native handle to ColumnFamilyOptions instance.
*/
private ColumnFamilyOptions(long handle) {
private ColumnFamilyOptions(final long handle) {
super();
nativeHandle_ = handle;
}

View File

@ -14,7 +14,7 @@ import java.util.Properties;
* If {@link #dispose()} function is not called, then it will be GC'd automatically
* and native resources will be released as part of the process.
*/
public class DBOptions extends RocksObject implements DBOptionsInterface {
public final class DBOptions extends RocksObject implements DBOptionsInterface {
static {
RocksDB.loadLibrary();
}
@ -51,7 +51,7 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
* {@link java.util.Properties} instance is passed to the method call.
*/
public static DBOptions getDBOptionsFromProps(
Properties properties) {
final Properties properties) {
if (properties == null || properties.size() == 0) {
throw new IllegalArgumentException(
"Properties value must contain at least one value.");
@ -73,14 +73,15 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
}
@Override
public DBOptions setIncreaseParallelism(int totalThreads) {
public DBOptions setIncreaseParallelism(
final int totalThreads) {
assert (isInitialized());
setIncreaseParallelism(nativeHandle_, totalThreads);
return this;
}
@Override
public DBOptions setCreateIfMissing(boolean flag) {
public DBOptions setCreateIfMissing(final boolean flag) {
assert(isInitialized());
setCreateIfMissing(nativeHandle_, flag);
return this;
@ -93,7 +94,8 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
}
@Override
public DBOptions setCreateMissingColumnFamilies(boolean flag) {
public DBOptions setCreateMissingColumnFamilies(
final boolean flag) {
assert(isInitialized());
setCreateMissingColumnFamilies(nativeHandle_, flag);
return this;
@ -106,7 +108,8 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
}
@Override
public DBOptions setErrorIfExists(boolean errorIfExists) {
public DBOptions setErrorIfExists(
final boolean errorIfExists) {
assert(isInitialized());
setErrorIfExists(nativeHandle_, errorIfExists);
return this;
@ -119,7 +122,8 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
}
@Override
public DBOptions setParanoidChecks(boolean paranoidChecks) {
public DBOptions setParanoidChecks(
final boolean paranoidChecks) {
assert(isInitialized());
setParanoidChecks(nativeHandle_, paranoidChecks);
return this;
@ -132,7 +136,8 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
}
@Override
public DBOptions setRateLimiterConfig(RateLimiterConfig config) {
public DBOptions setRateLimiterConfig(
final RateLimiterConfig config) {
assert(isInitialized());
rateLimiterConfig_ = config;
setRateLimiter(nativeHandle_, config.newRateLimiterHandle());
@ -140,7 +145,8 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
}
@Override
public DBOptions setInfoLogLevel(InfoLogLevel infoLogLevel) {
public DBOptions setInfoLogLevel(
final InfoLogLevel infoLogLevel) {
assert(isInitialized());
setInfoLogLevel(nativeHandle_, infoLogLevel.getValue());
return this;
@ -154,7 +160,8 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
}
@Override
public DBOptions setMaxOpenFiles(int maxOpenFiles) {
public DBOptions setMaxOpenFiles(
final int maxOpenFiles) {
assert(isInitialized());
setMaxOpenFiles(nativeHandle_, maxOpenFiles);
return this;
@ -167,7 +174,8 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
}
@Override
public DBOptions setMaxTotalWalSize(long maxTotalWalSize) {
public DBOptions setMaxTotalWalSize(
final long maxTotalWalSize) {
assert(isInitialized());
setMaxTotalWalSize(nativeHandle_, maxTotalWalSize);
return this;
@ -200,7 +208,8 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
}
@Override
public DBOptions setDisableDataSync(boolean disableDataSync) {
public DBOptions setDisableDataSync(
final boolean disableDataSync) {
assert(isInitialized());
setDisableDataSync(nativeHandle_, disableDataSync);
return this;
@ -213,7 +222,8 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
}
@Override
public DBOptions setUseFsync(boolean useFsync) {
public DBOptions setUseFsync(
final boolean useFsync) {
assert(isInitialized());
setUseFsync(nativeHandle_, useFsync);
return this;
@ -226,7 +236,8 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
}
@Override
public DBOptions setDbLogDir(String dbLogDir) {
public DBOptions setDbLogDir(
final String dbLogDir) {
assert(isInitialized());
setDbLogDir(nativeHandle_, dbLogDir);
return this;
@ -239,7 +250,8 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
}
@Override
public DBOptions setWalDir(String walDir) {
public DBOptions setWalDir(
final String walDir) {
assert(isInitialized());
setWalDir(nativeHandle_, walDir);
return this;
@ -252,7 +264,8 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
}
@Override
public DBOptions setDeleteObsoleteFilesPeriodMicros(long micros) {
public DBOptions setDeleteObsoleteFilesPeriodMicros(
final long micros) {
assert(isInitialized());
setDeleteObsoleteFilesPeriodMicros(nativeHandle_, micros);
return this;
@ -265,7 +278,8 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
}
@Override
public DBOptions setMaxBackgroundCompactions(int maxBackgroundCompactions) {
public DBOptions setMaxBackgroundCompactions(
final int maxBackgroundCompactions) {
assert(isInitialized());
setMaxBackgroundCompactions(nativeHandle_, maxBackgroundCompactions);
return this;
@ -278,7 +292,8 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
}
@Override
public DBOptions setMaxBackgroundFlushes(int maxBackgroundFlushes) {
public DBOptions setMaxBackgroundFlushes(
final int maxBackgroundFlushes) {
assert(isInitialized());
setMaxBackgroundFlushes(nativeHandle_, maxBackgroundFlushes);
return this;
@ -291,8 +306,8 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
}
@Override
public DBOptions setMaxLogFileSize(long maxLogFileSize)
throws RocksDBException {
public DBOptions setMaxLogFileSize(
final long maxLogFileSize) throws RocksDBException {
assert(isInitialized());
setMaxLogFileSize(nativeHandle_, maxLogFileSize);
return this;
@ -305,8 +320,8 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
}
@Override
public DBOptions setLogFileTimeToRoll(long logFileTimeToRoll)
throws RocksDBException{
public DBOptions setLogFileTimeToRoll(
final long logFileTimeToRoll) throws RocksDBException{
assert(isInitialized());
setLogFileTimeToRoll(nativeHandle_, logFileTimeToRoll);
return this;
@ -319,8 +334,8 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
}
@Override
public DBOptions setKeepLogFileNum(long keepLogFileNum)
throws RocksDBException{
public DBOptions setKeepLogFileNum(
final long keepLogFileNum) throws RocksDBException{
assert(isInitialized());
setKeepLogFileNum(nativeHandle_, keepLogFileNum);
return this;
@ -333,7 +348,8 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
}
@Override
public DBOptions setMaxManifestFileSize(long maxManifestFileSize) {
public DBOptions setMaxManifestFileSize(
final long maxManifestFileSize) {
assert(isInitialized());
setMaxManifestFileSize(nativeHandle_, maxManifestFileSize);
return this;
@ -346,7 +362,8 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
}
@Override
public DBOptions setTableCacheNumshardbits(int tableCacheNumshardbits) {
public DBOptions setTableCacheNumshardbits(
final int tableCacheNumshardbits) {
assert(isInitialized());
setTableCacheNumshardbits(nativeHandle_, tableCacheNumshardbits);
return this;
@ -359,7 +376,8 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
}
@Override
public DBOptions setTableCacheRemoveScanCountLimit(int limit) {
public DBOptions setTableCacheRemoveScanCountLimit(
final int limit) {
assert(isInitialized());
setTableCacheRemoveScanCountLimit(nativeHandle_, limit);
return this;
@ -372,7 +390,8 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
}
@Override
public DBOptions setWalTtlSeconds(long walTtlSeconds) {
public DBOptions setWalTtlSeconds(
final long walTtlSeconds) {
assert(isInitialized());
setWalTtlSeconds(nativeHandle_, walTtlSeconds);
return this;
@ -385,7 +404,8 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
}
@Override
public DBOptions setWalSizeLimitMB(long sizeLimitMB) {
public DBOptions setWalSizeLimitMB(
final long sizeLimitMB) {
assert(isInitialized());
setWalSizeLimitMB(nativeHandle_, sizeLimitMB);
return this;
@ -398,8 +418,8 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
}
@Override
public DBOptions setManifestPreallocationSize(long size)
throws RocksDBException {
public DBOptions setManifestPreallocationSize(
final long size) throws RocksDBException {
assert(isInitialized());
setManifestPreallocationSize(nativeHandle_, size);
return this;
@ -412,7 +432,8 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
}
@Override
public DBOptions setAllowOsBuffer(boolean allowOsBuffer) {
public DBOptions setAllowOsBuffer(
final boolean allowOsBuffer) {
assert(isInitialized());
setAllowOsBuffer(nativeHandle_, allowOsBuffer);
return this;
@ -425,7 +446,8 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
}
@Override
public DBOptions setAllowMmapReads(boolean allowMmapReads) {
public DBOptions setAllowMmapReads(
final boolean allowMmapReads) {
assert(isInitialized());
setAllowMmapReads(nativeHandle_, allowMmapReads);
return this;
@ -438,7 +460,8 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
}
@Override
public DBOptions setAllowMmapWrites(boolean allowMmapWrites) {
public DBOptions setAllowMmapWrites(
final boolean allowMmapWrites) {
assert(isInitialized());
setAllowMmapWrites(nativeHandle_, allowMmapWrites);
return this;
@ -451,7 +474,8 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
}
@Override
public DBOptions setIsFdCloseOnExec(boolean isFdCloseOnExec) {
public DBOptions setIsFdCloseOnExec(
final boolean isFdCloseOnExec) {
assert(isInitialized());
setIsFdCloseOnExec(nativeHandle_, isFdCloseOnExec);
return this;
@ -465,7 +489,8 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
@Override
@Deprecated
public DBOptions setSkipLogErrorOnRecovery(boolean skip) {
public DBOptions setSkipLogErrorOnRecovery(
final boolean skip) {
assert(isInitialized());
setSkipLogErrorOnRecovery(nativeHandle_, skip);
return this;
@ -479,7 +504,8 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
}
@Override
public DBOptions setStatsDumpPeriodSec(int statsDumpPeriodSec) {
public DBOptions setStatsDumpPeriodSec(
final int statsDumpPeriodSec) {
assert(isInitialized());
setStatsDumpPeriodSec(nativeHandle_, statsDumpPeriodSec);
return this;
@ -492,7 +518,8 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
}
@Override
public DBOptions setAdviseRandomOnOpen(boolean adviseRandomOnOpen) {
public DBOptions setAdviseRandomOnOpen(
final boolean adviseRandomOnOpen) {
assert(isInitialized());
setAdviseRandomOnOpen(nativeHandle_, adviseRandomOnOpen);
return this;
@ -504,7 +531,8 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
}
@Override
public DBOptions setUseAdaptiveMutex(boolean useAdaptiveMutex) {
public DBOptions setUseAdaptiveMutex(
final boolean useAdaptiveMutex) {
assert(isInitialized());
setUseAdaptiveMutex(nativeHandle_, useAdaptiveMutex);
return this;
@ -517,7 +545,8 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
}
@Override
public DBOptions setBytesPerSync(long bytesPerSync) {
public DBOptions setBytesPerSync(
final long bytesPerSync) {
assert(isInitialized());
setBytesPerSync(nativeHandle_, bytesPerSync);
return this;
@ -545,7 +574,7 @@ public class DBOptions extends RocksObject implements DBOptionsInterface {
*
* @param handle native handle to DBOptions instance.
*/
private DBOptions(long handle) {
private DBOptions(final long handle) {
super();
nativeHandle_ = handle;
}

View File

@ -4,7 +4,7 @@ package org.rocksdb;
* FlushOptions to be passed to flush operations of
* {@link org.rocksdb.RocksDB}.
*/
public class FlushOptions extends RocksObject {
public final class FlushOptions extends RocksObject {
/**
* Construct a new instance of FlushOptions.
@ -22,7 +22,7 @@ public class FlushOptions extends RocksObject {
*
* @return instance of current FlushOptions.
*/
public FlushOptions setWaitForFlush(boolean waitForFlush) {
public FlushOptions setWaitForFlush(final boolean waitForFlush) {
assert(isInitialized());
setWaitForFlush(nativeHandle_, waitForFlush);
return this;

View File

@ -34,8 +34,8 @@ public class GenericRateLimiterConfig extends RateLimiterConfig {
* fairness chance even though high-pri requests exist to avoid starvation.
* You should be good by leaving it at default 10.
*/
public GenericRateLimiterConfig(long rateBytesPerSecond,
long refillPeriodMicros, int fairness) {
public GenericRateLimiterConfig(final long rateBytesPerSecond,
final long refillPeriodMicros, final int fairness) {
rateBytesPerSecond_ = rateBytesPerSecond;
refillPeriodMicros_ = refillPeriodMicros;
fairness_ = fairness;
@ -49,7 +49,7 @@ public class GenericRateLimiterConfig extends RateLimiterConfig {
* and flush in bytes per second. Currently, RocksDB does not enforce
* rate limit for anything other than flush and compaction, e.g. write to WAL.
*/
public GenericRateLimiterConfig(long rateBytesPerSecond) {
public GenericRateLimiterConfig(final long rateBytesPerSecond) {
this(rateBytesPerSecond, DEFAULT_REFILL_PERIOD_MICROS, DEFAULT_FAIRNESS);
}

View File

@ -13,7 +13,7 @@ package org.rocksdb;
* use the default memtable representation (SkipList) instead
* and post a warning in the LOG.
*/
public class HashLinkedListMemTableConfig extends MemTableConfig {
public final class HashLinkedListMemTableConfig extends MemTableConfig {
public static final long DEFAULT_BUCKET_COUNT = 50000;
public static final long DEFAULT_HUGE_PAGE_TLB_SIZE = 0;
public static final int DEFAULT_BUCKET_ENTRIES_LOG_THRES = 4096;
@ -39,7 +39,8 @@ public class HashLinkedListMemTableConfig extends MemTableConfig {
* @param count the number of hash buckets.
* @return the reference to the current HashLinkedListMemTableConfig.
*/
public HashLinkedListMemTableConfig setBucketCount(long count) {
public HashLinkedListMemTableConfig setBucketCount(
final long count) {
bucketCount_ = count;
return this;
}
@ -66,7 +67,8 @@ public class HashLinkedListMemTableConfig extends MemTableConfig {
* @param size if set to {@code <= 0} hashtable bytes from malloc
* @return the reference to the current HashLinkedListMemTableConfig.
*/
public HashLinkedListMemTableConfig setHugePageTlbSize(long size) {
public HashLinkedListMemTableConfig setHugePageTlbSize(
final long size) {
hugePageTlbSize_ = size;
return this;
}
@ -89,7 +91,7 @@ public class HashLinkedListMemTableConfig extends MemTableConfig {
* @return the reference to the current HashLinkedListMemTableConfig.
*/
public HashLinkedListMemTableConfig
setBucketEntriesLoggingThreshold(int threshold) {
setBucketEntriesLoggingThreshold(final int threshold) {
bucketEntriesLoggingThreshold_ = threshold;
return this;
}
@ -113,7 +115,7 @@ public class HashLinkedListMemTableConfig extends MemTableConfig {
* @return the reference to the current HashLinkedListMemTableConfig.
*/
public HashLinkedListMemTableConfig
setIfLogBucketDistWhenFlush(boolean logDistribution) {
setIfLogBucketDistWhenFlush(final boolean logDistribution) {
ifLogBucketDistWhenFlush_ = logDistribution;
return this;
}
@ -137,7 +139,7 @@ public class HashLinkedListMemTableConfig extends MemTableConfig {
* @return the reference to the current HashLinkedListMemTableConfig.
*/
public HashLinkedListMemTableConfig
setThresholdUseSkiplist(int threshold) {
setThresholdUseSkiplist(final int threshold) {
thresholdUseSkiplist_ = threshold;
return this;
}

View File

@ -13,7 +13,7 @@ package org.rocksdb;
* use the default memtable representation (SkipList) instead
* and post a warning in the LOG.
*/
public class HashSkipListMemTableConfig extends MemTableConfig {
public final class HashSkipListMemTableConfig extends MemTableConfig {
public static final int DEFAULT_BUCKET_COUNT = 1000000;
public static final int DEFAULT_BRANCHING_FACTOR = 4;
public static final int DEFAULT_HEIGHT = 4;
@ -35,7 +35,8 @@ public class HashSkipListMemTableConfig extends MemTableConfig {
* skiplist memtable.
* @return the reference to the current HashSkipListMemTableConfig.
*/
public HashSkipListMemTableConfig setBucketCount(long count) {
public HashSkipListMemTableConfig setBucketCount(
final long count) {
bucketCount_ = count;
return this;
}
@ -54,7 +55,7 @@ public class HashSkipListMemTableConfig extends MemTableConfig {
*
* @return the reference to the current HashSkipListMemTableConfig.
*/
public HashSkipListMemTableConfig setHeight(int height) {
public HashSkipListMemTableConfig setHeight(final int height) {
height_ = height;
return this;
}
@ -75,7 +76,8 @@ public class HashSkipListMemTableConfig extends MemTableConfig {
* lists in the skip list.
* @return the reference to the current HashSkipListMemTableConfig.
*/
public HashSkipListMemTableConfig setBranchingFactor(int bf) {
public HashSkipListMemTableConfig setBranchingFactor(
final int bf) {
branchingFactor_ = bf;
return this;
}

View File

@ -12,8 +12,9 @@ public class HistogramData {
private final double average_;
private final double standardDeviation_;
public HistogramData(double median, double percentile95,
double percentile99, double average, double standardDeviation) {
public HistogramData(final double median, final double percentile95,
final double percentile99, final double average,
final double standardDeviation) {
median_ = median;
percentile95_ = percentile95;
percentile99_ = percentile99;

View File

@ -12,7 +12,7 @@ package org.rocksdb;
* If {@link #dispose()} function is not called, then it will be GC'd automatically
* and native resources will be released as part of the process.
*/
public class Options extends RocksObject
public final class Options extends RocksObject
implements DBOptionsInterface, ColumnFamilyOptionsInterface {
static {
RocksDB.loadLibrary();
@ -37,28 +37,29 @@ public class Options extends RocksObject
* @param columnFamilyOptions {@link org.rocksdb.ColumnFamilyOptions}
* instance
*/
public Options(DBOptions dbOptions, ColumnFamilyOptions columnFamilyOptions) {
public Options(final DBOptions dbOptions,
final ColumnFamilyOptions columnFamilyOptions) {
super();
newOptions(dbOptions.nativeHandle_, columnFamilyOptions.nativeHandle_);
env_ = RocksEnv.getDefault();
}
@Override
public Options setIncreaseParallelism(int totalThreads) {
public Options setIncreaseParallelism(final int totalThreads) {
assert(isInitialized());
setIncreaseParallelism(nativeHandle_, totalThreads);
return this;
}
@Override
public Options setCreateIfMissing(boolean flag) {
public Options setCreateIfMissing(final boolean flag) {
assert(isInitialized());
setCreateIfMissing(nativeHandle_, flag);
return this;
}
@Override
public Options setCreateMissingColumnFamilies(boolean flag) {
public Options setCreateMissingColumnFamilies(final boolean flag) {
assert(isInitialized());
setCreateMissingColumnFamilies(nativeHandle_, flag);
return this;
@ -72,7 +73,7 @@ public class Options extends RocksObject
* @param env {@link RocksEnv} instance.
* @return the instance of the current Options.
*/
public Options setEnv(RocksEnv env) {
public Options setEnv(final RocksEnv env) {
assert(isInitialized());
setEnv(nativeHandle_, env.nativeHandle_);
env_ = env;
@ -149,14 +150,14 @@ public class Options extends RocksObject
@Override
public Options optimizeUniversalStyleCompaction(
long memtableMemoryBudget) {
final long memtableMemoryBudget) {
optimizeUniversalStyleCompaction(nativeHandle_,
memtableMemoryBudget);
return this;
}
@Override
public Options setComparator(BuiltinComparator builtinComparator) {
public Options setComparator(final BuiltinComparator builtinComparator) {
assert(isInitialized());
setComparatorHandle(nativeHandle_, builtinComparator.ordinal());
return this;
@ -164,7 +165,7 @@ public class Options extends RocksObject
@Override
public Options setComparator(
AbstractComparator<? extends AbstractSlice<?>> comparator) {
final AbstractComparator<? extends AbstractSlice<?>> comparator) {
assert (isInitialized());
setComparatorHandle(nativeHandle_, comparator.nativeHandle_);
comparator_ = comparator;
@ -172,7 +173,7 @@ public class Options extends RocksObject
}
@Override
public Options setMergeOperatorName(String name) {
public Options setMergeOperatorName(final String name) {
assert (isInitialized());
if (name == null) {
throw new IllegalArgumentException(
@ -183,13 +184,13 @@ public class Options extends RocksObject
}
@Override
public Options setMergeOperator(MergeOperator mergeOperator) {
public Options setMergeOperator(final MergeOperator mergeOperator) {
setMergeOperator(nativeHandle_, mergeOperator.newMergeOperatorHandle());
return this;
}
@Override
public Options setWriteBufferSize(long writeBufferSize)
public Options setWriteBufferSize(final long writeBufferSize)
throws RocksDBException {
assert(isInitialized());
setWriteBufferSize(nativeHandle_, writeBufferSize);
@ -203,7 +204,7 @@ public class Options extends RocksObject
}
@Override
public Options setMaxWriteBufferNumber(int maxWriteBufferNumber) {
public Options setMaxWriteBufferNumber(final int maxWriteBufferNumber) {
assert(isInitialized());
setMaxWriteBufferNumber(nativeHandle_, maxWriteBufferNumber);
return this;
@ -222,7 +223,7 @@ public class Options extends RocksObject
}
@Override
public Options setErrorIfExists(boolean errorIfExists) {
public Options setErrorIfExists(final boolean errorIfExists) {
assert(isInitialized());
setErrorIfExists(nativeHandle_, errorIfExists);
return this;
@ -235,7 +236,7 @@ public class Options extends RocksObject
}
@Override
public Options setParanoidChecks(boolean paranoidChecks) {
public Options setParanoidChecks(final boolean paranoidChecks) {
assert(isInitialized());
setParanoidChecks(nativeHandle_, paranoidChecks);
return this;
@ -248,7 +249,7 @@ public class Options extends RocksObject
}
@Override
public Options setMaxTotalWalSize(long maxTotalWalSize) {
public Options setMaxTotalWalSize(final long maxTotalWalSize) {
assert(isInitialized());
setMaxTotalWalSize(nativeHandle_, maxTotalWalSize);
return this;
@ -261,7 +262,7 @@ public class Options extends RocksObject
}
@Override
public Options setMaxOpenFiles(int maxOpenFiles) {
public Options setMaxOpenFiles(final int maxOpenFiles) {
assert(isInitialized());
setMaxOpenFiles(nativeHandle_, maxOpenFiles);
return this;
@ -274,7 +275,7 @@ public class Options extends RocksObject
}
@Override
public Options setDisableDataSync(boolean disableDataSync) {
public Options setDisableDataSync(final boolean disableDataSync) {
assert(isInitialized());
setDisableDataSync(nativeHandle_, disableDataSync);
return this;
@ -287,7 +288,7 @@ public class Options extends RocksObject
}
@Override
public Options setUseFsync(boolean useFsync) {
public Options setUseFsync(final boolean useFsync) {
assert(isInitialized());
setUseFsync(nativeHandle_, useFsync);
return this;
@ -300,7 +301,7 @@ public class Options extends RocksObject
}
@Override
public Options setDbLogDir(String dbLogDir) {
public Options setDbLogDir(final String dbLogDir) {
assert(isInitialized());
setDbLogDir(nativeHandle_, dbLogDir);
return this;
@ -313,7 +314,7 @@ public class Options extends RocksObject
}
@Override
public Options setWalDir(String walDir) {
public Options setWalDir(final String walDir) {
assert(isInitialized());
setWalDir(nativeHandle_, walDir);
return this;
@ -326,7 +327,8 @@ public class Options extends RocksObject
}
@Override
public Options setDeleteObsoleteFilesPeriodMicros(long micros) {
public Options setDeleteObsoleteFilesPeriodMicros(
final long micros) {
assert(isInitialized());
setDeleteObsoleteFilesPeriodMicros(nativeHandle_, micros);
return this;
@ -359,7 +361,8 @@ public class Options extends RocksObject
}
@Override
public Options setMaxBackgroundCompactions(int maxBackgroundCompactions) {
public Options setMaxBackgroundCompactions(
final int maxBackgroundCompactions) {
assert(isInitialized());
setMaxBackgroundCompactions(nativeHandle_, maxBackgroundCompactions);
return this;
@ -372,7 +375,8 @@ public class Options extends RocksObject
}
@Override
public Options setMaxBackgroundFlushes(int maxBackgroundFlushes) {
public Options setMaxBackgroundFlushes(
final int maxBackgroundFlushes) {
assert(isInitialized());
setMaxBackgroundFlushes(nativeHandle_, maxBackgroundFlushes);
return this;
@ -385,7 +389,7 @@ public class Options extends RocksObject
}
@Override
public Options setMaxLogFileSize(long maxLogFileSize)
public Options setMaxLogFileSize(final long maxLogFileSize)
throws RocksDBException {
assert(isInitialized());
setMaxLogFileSize(nativeHandle_, maxLogFileSize);
@ -399,7 +403,7 @@ public class Options extends RocksObject
}
@Override
public Options setLogFileTimeToRoll(long logFileTimeToRoll)
public Options setLogFileTimeToRoll(final long logFileTimeToRoll)
throws RocksDBException{
assert(isInitialized());
setLogFileTimeToRoll(nativeHandle_, logFileTimeToRoll);
@ -413,7 +417,7 @@ public class Options extends RocksObject
}
@Override
public Options setKeepLogFileNum(long keepLogFileNum)
public Options setKeepLogFileNum(final long keepLogFileNum)
throws RocksDBException{
assert(isInitialized());
setKeepLogFileNum(nativeHandle_, keepLogFileNum);
@ -427,7 +431,8 @@ public class Options extends RocksObject
}
@Override
public Options setMaxManifestFileSize(long maxManifestFileSize) {
public Options setMaxManifestFileSize(
final long maxManifestFileSize) {
assert(isInitialized());
setMaxManifestFileSize(nativeHandle_, maxManifestFileSize);
return this;
@ -440,7 +445,8 @@ public class Options extends RocksObject
}
@Override
public Options setTableCacheNumshardbits(int tableCacheNumshardbits) {
public Options setTableCacheNumshardbits(
final int tableCacheNumshardbits) {
assert(isInitialized());
setTableCacheNumshardbits(nativeHandle_, tableCacheNumshardbits);
return this;
@ -453,7 +459,8 @@ public class Options extends RocksObject
}
@Override
public Options setTableCacheRemoveScanCountLimit(int limit) {
public Options setTableCacheRemoveScanCountLimit(
final int limit) {
assert(isInitialized());
setTableCacheRemoveScanCountLimit(nativeHandle_, limit);
return this;
@ -466,7 +473,7 @@ public class Options extends RocksObject
}
@Override
public Options setWalTtlSeconds(long walTtlSeconds) {
public Options setWalTtlSeconds(final long walTtlSeconds) {
assert(isInitialized());
setWalTtlSeconds(nativeHandle_, walTtlSeconds);
return this;
@ -479,7 +486,7 @@ public class Options extends RocksObject
}
@Override
public Options setWalSizeLimitMB(long sizeLimitMB) {
public Options setWalSizeLimitMB(final long sizeLimitMB) {
assert(isInitialized());
setWalSizeLimitMB(nativeHandle_, sizeLimitMB);
return this;
@ -492,7 +499,7 @@ public class Options extends RocksObject
}
@Override
public Options setManifestPreallocationSize(long size)
public Options setManifestPreallocationSize(final long size)
throws RocksDBException {
assert(isInitialized());
setManifestPreallocationSize(nativeHandle_, size);
@ -506,7 +513,7 @@ public class Options extends RocksObject
}
@Override
public Options setAllowOsBuffer(boolean allowOsBuffer) {
public Options setAllowOsBuffer(final boolean allowOsBuffer) {
assert(isInitialized());
setAllowOsBuffer(nativeHandle_, allowOsBuffer);
return this;
@ -519,7 +526,7 @@ public class Options extends RocksObject
}
@Override
public Options setAllowMmapReads(boolean allowMmapReads) {
public Options setAllowMmapReads(final boolean allowMmapReads) {
assert(isInitialized());
setAllowMmapReads(nativeHandle_, allowMmapReads);
return this;
@ -532,7 +539,7 @@ public class Options extends RocksObject
}
@Override
public Options setAllowMmapWrites(boolean allowMmapWrites) {
public Options setAllowMmapWrites(final boolean allowMmapWrites) {
assert(isInitialized());
setAllowMmapWrites(nativeHandle_, allowMmapWrites);
return this;
@ -545,7 +552,7 @@ public class Options extends RocksObject
}
@Override
public Options setIsFdCloseOnExec(boolean isFdCloseOnExec) {
public Options setIsFdCloseOnExec(final boolean isFdCloseOnExec) {
assert(isInitialized());
setIsFdCloseOnExec(nativeHandle_, isFdCloseOnExec);
return this;
@ -560,7 +567,7 @@ public class Options extends RocksObject
@Override
@Deprecated
public Options setSkipLogErrorOnRecovery(boolean skip) {
public Options setSkipLogErrorOnRecovery(final boolean skip) {
assert(isInitialized());
setSkipLogErrorOnRecovery(nativeHandle_, skip);
return this;
@ -573,7 +580,7 @@ public class Options extends RocksObject
}
@Override
public Options setStatsDumpPeriodSec(int statsDumpPeriodSec) {
public Options setStatsDumpPeriodSec(final int statsDumpPeriodSec) {
assert(isInitialized());
setStatsDumpPeriodSec(nativeHandle_, statsDumpPeriodSec);
return this;
@ -585,7 +592,7 @@ public class Options extends RocksObject
}
@Override
public Options setAdviseRandomOnOpen(boolean adviseRandomOnOpen) {
public Options setAdviseRandomOnOpen(final boolean adviseRandomOnOpen) {
assert(isInitialized());
setAdviseRandomOnOpen(nativeHandle_, adviseRandomOnOpen);
return this;
@ -598,7 +605,7 @@ public class Options extends RocksObject
}
@Override
public Options setUseAdaptiveMutex(boolean useAdaptiveMutex) {
public Options setUseAdaptiveMutex(final boolean useAdaptiveMutex) {
assert(isInitialized());
setUseAdaptiveMutex(nativeHandle_, useAdaptiveMutex);
return this;
@ -610,14 +617,14 @@ public class Options extends RocksObject
}
@Override
public Options setBytesPerSync(long bytesPerSync) {
public Options setBytesPerSync(final long bytesPerSync) {
assert(isInitialized());
setBytesPerSync(nativeHandle_, bytesPerSync);
return this;
}
@Override
public Options setMemTableConfig(MemTableConfig config)
public Options setMemTableConfig(final MemTableConfig config)
throws RocksDBException {
memTableConfig_ = config;
setMemTableFactory(nativeHandle_, config.newMemTableFactoryHandle());
@ -625,14 +632,14 @@ public class Options extends RocksObject
}
@Override
public Options setRateLimiterConfig(RateLimiterConfig config) {
public Options setRateLimiterConfig(final RateLimiterConfig config) {
rateLimiterConfig_ = config;
setRateLimiter(nativeHandle_, config.newRateLimiterHandle());
return this;
}
@Override
public Options setInfoLogLevel(InfoLogLevel infoLogLevel) {
public Options setInfoLogLevel(final InfoLogLevel infoLogLevel) {
assert(isInitialized());
setInfoLogLevel(nativeHandle_, infoLogLevel.getValue());
return this;
@ -652,7 +659,7 @@ public class Options extends RocksObject
}
@Override
public Options setTableFormatConfig(TableFormatConfig config) {
public Options setTableFormatConfig(final TableFormatConfig config) {
tableFormatConfig_ = config;
setTableFactory(nativeHandle_, config.newTableFactoryHandle());
return this;
@ -665,7 +672,7 @@ public class Options extends RocksObject
}
@Override
public Options useFixedLengthPrefixExtractor(int n) {
public Options useFixedLengthPrefixExtractor(final int n) {
assert(isInitialized());
useFixedLengthPrefixExtractor(nativeHandle_, n);
return this;
@ -688,7 +695,8 @@ public class Options extends RocksObject
}
@Override
public Options setCompactionStyle(CompactionStyle compactionStyle) {
public Options setCompactionStyle(
final CompactionStyle compactionStyle) {
setCompactionStyle(nativeHandle_, compactionStyle.getValue());
return this;
}
@ -711,7 +719,7 @@ public class Options extends RocksObject
@Override
public Options setLevelZeroFileNumCompactionTrigger(
int numFiles) {
final int numFiles) {
setLevelZeroFileNumCompactionTrigger(
nativeHandle_, numFiles);
return this;
@ -724,7 +732,7 @@ public class Options extends RocksObject
@Override
public Options setLevelZeroSlowdownWritesTrigger(
int numFiles) {
final int numFiles) {
setLevelZeroSlowdownWritesTrigger(nativeHandle_, numFiles);
return this;
}
@ -735,7 +743,8 @@ public class Options extends RocksObject
}
@Override
public Options setLevelZeroStopWritesTrigger(int numFiles) {
public Options setLevelZeroStopWritesTrigger(
final int numFiles) {
setLevelZeroStopWritesTrigger(nativeHandle_, numFiles);
return this;
}
@ -746,7 +755,8 @@ public class Options extends RocksObject
}
@Override
public Options setMaxMemCompactionLevel(int maxMemCompactionLevel) {
public Options setMaxMemCompactionLevel(
final int maxMemCompactionLevel) {
setMaxMemCompactionLevel(nativeHandle_, maxMemCompactionLevel);
return this;
}
@ -779,7 +789,7 @@ public class Options extends RocksObject
}
@Override
public Options setMaxBytesForLevelBase(long maxBytesForLevelBase) {
public Options setMaxBytesForLevelBase(final long maxBytesForLevelBase) {
setMaxBytesForLevelBase(nativeHandle_, maxBytesForLevelBase);
return this;
}
@ -790,7 +800,7 @@ public class Options extends RocksObject
}
@Override
public Options setMaxBytesForLevelMultiplier(int multiplier) {
public Options setMaxBytesForLevelMultiplier(final int multiplier) {
setMaxBytesForLevelMultiplier(nativeHandle_, multiplier);
return this;
}
@ -801,7 +811,8 @@ public class Options extends RocksObject
}
@Override
public Options setExpandedCompactionFactor(int expandedCompactionFactor) {
public Options setExpandedCompactionFactor(
final int expandedCompactionFactor) {
setExpandedCompactionFactor(nativeHandle_, expandedCompactionFactor);
return this;
}
@ -824,7 +835,7 @@ public class Options extends RocksObject
@Override
public Options setMaxGrandparentOverlapFactor(
int maxGrandparentOverlapFactor) {
final int maxGrandparentOverlapFactor) {
setMaxGrandparentOverlapFactor(nativeHandle_, maxGrandparentOverlapFactor);
return this;
}
@ -835,7 +846,7 @@ public class Options extends RocksObject
}
@Override
public Options setSoftRateLimit(double softRateLimit) {
public Options setSoftRateLimit(final double softRateLimit) {
setSoftRateLimit(nativeHandle_, softRateLimit);
return this;
}
@ -858,7 +869,7 @@ public class Options extends RocksObject
@Override
public Options setRateLimitDelayMaxMilliseconds(
int rateLimitDelayMaxMilliseconds) {
final int rateLimitDelayMaxMilliseconds) {
setRateLimitDelayMaxMilliseconds(
nativeHandle_, rateLimitDelayMaxMilliseconds);
return this;
@ -870,7 +881,7 @@ public class Options extends RocksObject
}
@Override
public Options setArenaBlockSize(long arenaBlockSize)
public Options setArenaBlockSize(final long arenaBlockSize)
throws RocksDBException {
setArenaBlockSize(nativeHandle_, arenaBlockSize);
return this;
@ -882,7 +893,8 @@ public class Options extends RocksObject
}
@Override
public Options setDisableAutoCompactions(boolean disableAutoCompactions) {
public Options setDisableAutoCompactions(
final boolean disableAutoCompactions) {
setDisableAutoCompactions(nativeHandle_, disableAutoCompactions);
return this;
}
@ -894,7 +906,7 @@ public class Options extends RocksObject
@Override
public Options setPurgeRedundantKvsWhileFlush(
boolean purgeRedundantKvsWhileFlush) {
final boolean purgeRedundantKvsWhileFlush) {
setPurgeRedundantKvsWhileFlush(
nativeHandle_, purgeRedundantKvsWhileFlush);
return this;
@ -907,7 +919,7 @@ public class Options extends RocksObject
@Override
public Options setVerifyChecksumsInCompaction(
boolean verifyChecksumsInCompaction) {
final boolean verifyChecksumsInCompaction) {
setVerifyChecksumsInCompaction(
nativeHandle_, verifyChecksumsInCompaction);
return this;
@ -919,7 +931,8 @@ public class Options extends RocksObject
}
@Override
public Options setFilterDeletes(boolean filterDeletes) {
public Options setFilterDeletes(
final boolean filterDeletes) {
setFilterDeletes(nativeHandle_, filterDeletes);
return this;
}
@ -930,7 +943,8 @@ public class Options extends RocksObject
}
@Override
public Options setMaxSequentialSkipInIterations(long maxSequentialSkipInIterations) {
public Options setMaxSequentialSkipInIterations(
final long maxSequentialSkipInIterations) {
setMaxSequentialSkipInIterations(nativeHandle_, maxSequentialSkipInIterations);
return this;
}
@ -941,7 +955,8 @@ public class Options extends RocksObject
}
@Override
public Options setInplaceUpdateSupport(boolean inplaceUpdateSupport) {
public Options setInplaceUpdateSupport(
final boolean inplaceUpdateSupport) {
setInplaceUpdateSupport(nativeHandle_, inplaceUpdateSupport);
return this;
}
@ -952,8 +967,8 @@ public class Options extends RocksObject
}
@Override
public Options setInplaceUpdateNumLocks(long inplaceUpdateNumLocks)
throws RocksDBException {
public Options setInplaceUpdateNumLocks(
final long inplaceUpdateNumLocks) throws RocksDBException {
setInplaceUpdateNumLocks(nativeHandle_, inplaceUpdateNumLocks);
return this;
}
@ -964,7 +979,8 @@ public class Options extends RocksObject
}
@Override
public Options setMemtablePrefixBloomBits(int memtablePrefixBloomBits) {
public Options setMemtablePrefixBloomBits(
final int memtablePrefixBloomBits) {
setMemtablePrefixBloomBits(nativeHandle_, memtablePrefixBloomBits);
return this;
}
@ -975,7 +991,8 @@ public class Options extends RocksObject
}
@Override
public Options setMemtablePrefixBloomProbes(int memtablePrefixBloomProbes) {
public Options setMemtablePrefixBloomProbes(
final int memtablePrefixBloomProbes) {
setMemtablePrefixBloomProbes(nativeHandle_, memtablePrefixBloomProbes);
return this;
}
@ -986,7 +1003,7 @@ public class Options extends RocksObject
}
@Override
public Options setBloomLocality(int bloomLocality) {
public Options setBloomLocality(final int bloomLocality) {
setBloomLocality(nativeHandle_, bloomLocality);
return this;
}
@ -1009,7 +1026,8 @@ public class Options extends RocksObject
}
@Override
public Options setMinWriteBufferNumberToMerge(int minWriteBufferNumberToMerge) {
public Options setMinWriteBufferNumberToMerge(
final int minWriteBufferNumberToMerge) {
setMinWriteBufferNumberToMerge(nativeHandle_, minWriteBufferNumberToMerge);
return this;
}
@ -1020,7 +1038,8 @@ public class Options extends RocksObject
}
@Override
public Options setMinPartialMergeOperands(int minPartialMergeOperands) {
public Options setMinPartialMergeOperands(
final int minPartialMergeOperands) {
setMinPartialMergeOperands(nativeHandle_, minPartialMergeOperands);
return this;
}

View File

@ -12,7 +12,7 @@ package org.rocksdb;
*
* <p>It also support prefix hash feature.</p>
*/
public class PlainTableConfig extends TableFormatConfig {
public final class PlainTableConfig extends TableFormatConfig {
public static final int VARIABLE_LENGTH = 0;
public static final int DEFAULT_BLOOM_BITS_PER_KEY = 10;
public static final double DEFAULT_HASH_TABLE_RATIO = 0.75;

View File

@ -11,7 +11,7 @@ package org.rocksdb;
* Note that dispose() must be called before an Options instance
* become out-of-scope to release the allocated memory in c++.
*/
public class ReadOptions extends RocksObject {
public final class ReadOptions extends RocksObject {
public ReadOptions() {
super();
newReadOptions();
@ -40,7 +40,8 @@ public class ReadOptions extends RocksObject {
* will be performed on every read.
* @return the reference to the current ReadOptions.
*/
public ReadOptions setVerifyChecksums(boolean verifyChecksums) {
public ReadOptions setVerifyChecksums(
final boolean verifyChecksums) {
assert(isInitialized());
setVerifyChecksums(nativeHandle_, verifyChecksums);
return this;
@ -72,7 +73,7 @@ public class ReadOptions extends RocksObject {
* performed.
* @return the reference to the current ReadOptions.
*/
public ReadOptions setFillCache(boolean fillCache) {
public ReadOptions setFillCache(final boolean fillCache) {
assert(isInitialized());
setFillCache(nativeHandle_, fillCache);
return this;
@ -90,7 +91,7 @@ public class ReadOptions extends RocksObject {
* @param snapshot {@link Snapshot} instance
* @return the reference to the current ReadOptions.
*/
public ReadOptions setSnapshot(Snapshot snapshot) {
public ReadOptions setSnapshot(final Snapshot snapshot) {
assert(isInitialized());
if (snapshot != null) {
setSnapshot(nativeHandle_, snapshot.nativeHandle_);
@ -145,7 +146,7 @@ public class ReadOptions extends RocksObject {
* @param tailing if true, then tailing iterator will be enabled.
* @return the reference to the current ReadOptions.
*/
public ReadOptions setTailing(boolean tailing) {
public ReadOptions setTailing(final boolean tailing) {
assert(isInitialized());
setTailing(nativeHandle_, tailing);
return this;

View File

@ -16,13 +16,13 @@ import java.util.List;
* memory in c++.</p>
*
*/
public class RestoreBackupableDB extends RocksObject {
public final class RestoreBackupableDB extends RocksObject {
/**
* <p>Construct new estoreBackupableDB instance.</p>
*
* @param options {@link org.rocksdb.BackupableDBOptions} instance
*/
public RestoreBackupableDB(BackupableDBOptions options) {
public RestoreBackupableDB(final BackupableDBOptions options) {
super();
nativeHandle_ = newRestoreBackupableDB(options.nativeHandle_);
}
@ -49,8 +49,9 @@ public class RestoreBackupableDB extends RocksObject {
* @throws RocksDBException thrown if error happens in underlying
* native library.
*/
public void restoreDBFromBackup(long backupId, String dbDir, String walDir,
RestoreOptions restoreOptions) throws RocksDBException {
public void restoreDBFromBackup(final long backupId, final String dbDir,
final String walDir, final RestoreOptions restoreOptions)
throws RocksDBException {
assert(isInitialized());
restoreDBFromBackup0(nativeHandle_, backupId, dbDir, walDir,
restoreOptions.nativeHandle_);
@ -66,8 +67,9 @@ public class RestoreBackupableDB extends RocksObject {
* @throws RocksDBException thrown if error happens in underlying
* native library.
*/
public void restoreDBFromLatestBackup(String dbDir, String walDir,
RestoreOptions restoreOptions) throws RocksDBException {
public void restoreDBFromLatestBackup(final String dbDir,
final String walDir, final RestoreOptions restoreOptions)
throws RocksDBException {
assert(isInitialized());
restoreDBFromLatestBackup0(nativeHandle_, dbDir, walDir,
restoreOptions.nativeHandle_);
@ -81,7 +83,8 @@ public class RestoreBackupableDB extends RocksObject {
* @throws RocksDBException thrown if error happens in underlying
* native library.
*/
public void purgeOldBackups(int numBackupsToKeep) throws RocksDBException {
public void purgeOldBackups(final int numBackupsToKeep)
throws RocksDBException {
assert(isInitialized());
purgeOldBackups0(nativeHandle_, numBackupsToKeep);
}
@ -94,7 +97,8 @@ public class RestoreBackupableDB extends RocksObject {
* @throws RocksDBException thrown if error happens in underlying
* native library.
*/
public void deleteBackup(int backupId) throws RocksDBException {
public void deleteBackup(final int backupId)
throws RocksDBException {
assert(isInitialized());
deleteBackup0(nativeHandle_, backupId);
}

View File

@ -12,7 +12,7 @@ package org.rocksdb;
* to release the allocated memory in c++.
*
*/
public class RestoreOptions extends RocksObject {
public final class RestoreOptions extends RocksObject {
/**
* Constructor
*
@ -22,7 +22,7 @@ public class RestoreOptions extends RocksObject {
* for persisting in-memory databases.
* Default: false
*/
public RestoreOptions(boolean keepLogFiles) {
public RestoreOptions(final boolean keepLogFiles) {
super();
nativeHandle_ = newRestoreOptions(keepLogFiles);
}

View File

@ -59,7 +59,7 @@ public class RocksDB extends RocksObject {
* @param paths a list of strings where each describes a directory
* of a library.
*/
public static synchronized void loadLibrary(List<String> paths) {
public static synchronized void loadLibrary(final List<String> paths) {
for (CompressionType compressionType : CompressionType.values()) {
if (compressionType.equals(CompressionType.NO_COMPRESSION)) {
continue;
@ -103,7 +103,7 @@ public class RocksDB extends RocksObject {
* native library.
* @see Options#setCreateIfMissing(boolean)
*/
public static RocksDB open(String path) throws RocksDBException {
public static RocksDB open(final String path) throws RocksDBException {
// This allows to use the rocksjni default Options instead of
// the c++ one.
Options options = new Options();
@ -140,9 +140,10 @@ public class RocksDB extends RocksObject {
* native library.
* @see DBOptions#setCreateIfMissing(boolean)
*/
public static RocksDB open(String path,
List<ColumnFamilyDescriptor> columnFamilyDescriptors,
List<ColumnFamilyHandle> columnFamilyHandles) throws RocksDBException {
public static RocksDB open(final String path,
final List<ColumnFamilyDescriptor> columnFamilyDescriptors,
final List<ColumnFamilyHandle> columnFamilyHandles)
throws RocksDBException {
// This allows to use the rocksjni default Options instead of
// the c++ one.
DBOptions options = new DBOptions();
@ -173,7 +174,7 @@ public class RocksDB extends RocksObject {
*
* @see Options#setCreateIfMissing(boolean)
*/
public static RocksDB open(Options options, String path)
public static RocksDB open(final Options options, final String path)
throws RocksDBException {
// when non-default Options is used, keeping an Options reference
// in RocksDB can prevent Java to GC during the life-time of
@ -220,9 +221,9 @@ public class RocksDB extends RocksObject {
*
* @see DBOptions#setCreateIfMissing(boolean)
*/
public static RocksDB open(DBOptions options, String path,
List<ColumnFamilyDescriptor> columnFamilyDescriptors,
List<ColumnFamilyHandle> columnFamilyHandles)
public static RocksDB open(final DBOptions options, final String path,
final List<ColumnFamilyDescriptor> columnFamilyDescriptors,
final List<ColumnFamilyHandle> columnFamilyHandles)
throws RocksDBException {
RocksDB db = new RocksDB();
List<Long> cfReferences = db.open(options.nativeHandle_, path,
@ -246,7 +247,7 @@ public class RocksDB extends RocksObject {
* @throws RocksDBException thrown if error happens in underlying
* native library.
*/
public static RocksDB openReadOnly(String path)
public static RocksDB openReadOnly(final String path)
throws RocksDBException {
// This allows to use the rocksjni default Options instead of
// the c++ one.
@ -269,9 +270,10 @@ public class RocksDB extends RocksObject {
* @throws RocksDBException thrown if error happens in underlying
* native library.
*/
public static RocksDB openReadOnly(String path,
List<ColumnFamilyDescriptor> columnFamilyDescriptors,
List<ColumnFamilyHandle> columnFamilyHandles) throws RocksDBException {
public static RocksDB openReadOnly(final String path,
final List<ColumnFamilyDescriptor> columnFamilyDescriptors,
final List<ColumnFamilyHandle> columnFamilyHandles)
throws RocksDBException {
// This allows to use the rocksjni default Options instead of
// the c++ one.
DBOptions options = new DBOptions();
@ -296,7 +298,7 @@ public class RocksDB extends RocksObject {
* @throws RocksDBException thrown if error happens in underlying
* native library.
*/
public static RocksDB openReadOnly(Options options, String path)
public static RocksDB openReadOnly(final Options options, final String path)
throws RocksDBException {
// when non-default Options is used, keeping an Options reference
// in RocksDB can prevent Java to GC during the life-time of
@ -330,9 +332,9 @@ public class RocksDB extends RocksObject {
* @throws RocksDBException thrown if error happens in underlying
* native library.
*/
public static RocksDB openReadOnly(DBOptions options, String path,
List<ColumnFamilyDescriptor> columnFamilyDescriptors,
List<ColumnFamilyHandle> columnFamilyHandles)
public static RocksDB openReadOnly(final DBOptions options, final String path,
final List<ColumnFamilyDescriptor> columnFamilyDescriptors,
final List<ColumnFamilyHandle> columnFamilyHandles)
throws RocksDBException {
// when non-default Options is used, keeping an Options reference
// in RocksDB can prevent Java to GC during the life-time of
@ -358,8 +360,8 @@ public class RocksDB extends RocksObject {
* @throws RocksDBException thrown if error happens in underlying
* native library.
*/
public static List<byte[]> listColumnFamilies(Options options, String path)
throws RocksDBException {
public static List<byte[]> listColumnFamilies(final Options options,
final String path) throws RocksDBException {
return RocksDB.listColumnFamilies(options.nativeHandle_, path);
}
@ -391,7 +393,7 @@ public class RocksDB extends RocksObject {
* @throws RocksDBException thrown if error happens in underlying
* native library.
*/
public void put(byte[] key, byte[] value) throws RocksDBException {
public void put(final byte[] key, final byte[] value) throws RocksDBException {
put(nativeHandle_, key, key.length, value, value.length);
}
@ -409,8 +411,8 @@ public class RocksDB extends RocksObject {
* @throws RocksDBException thrown if error happens in underlying
* native library.
*/
public void put(ColumnFamilyHandle columnFamilyHandle, byte[] key,
byte[] value) throws RocksDBException {
public void put(final ColumnFamilyHandle columnFamilyHandle,
final byte[] key, final byte[] value) throws RocksDBException {
put(nativeHandle_, key, key.length, value, value.length,
columnFamilyHandle.nativeHandle_);
}
@ -425,8 +427,8 @@ public class RocksDB extends RocksObject {
* @throws RocksDBException thrown if error happens in underlying
* native library.
*/
public void put(WriteOptions writeOpts, byte[] key, byte[] value)
throws RocksDBException {
public void put(final WriteOptions writeOpts, final byte[] key,
final byte[] value) throws RocksDBException {
put(nativeHandle_, writeOpts.nativeHandle_,
key, key.length, value, value.length);
}
@ -447,8 +449,9 @@ public class RocksDB extends RocksObject {
* native library.
* @see IllegalArgumentException
*/
public void put(ColumnFamilyHandle columnFamilyHandle, WriteOptions writeOpts,
byte[] key, byte[] value) throws RocksDBException {
public void put(final ColumnFamilyHandle columnFamilyHandle,
final WriteOptions writeOpts, final byte[] key,
final byte[] value) throws RocksDBException {
put(nativeHandle_, writeOpts.nativeHandle_, key, key.length, value, value.length,
columnFamilyHandle.nativeHandle_);
}
@ -465,7 +468,7 @@ public class RocksDB extends RocksObject {
* found in block-cache.
* @return boolean value indicating if key does not exist or might exist.
*/
public boolean keyMayExist(byte[] key, StringBuffer value){
public boolean keyMayExist(final byte[] key, final StringBuffer value){
return keyMayExist(key, key.length, value);
}
@ -482,8 +485,8 @@ public class RocksDB extends RocksObject {
* found in block-cache.
* @return boolean value indicating if key does not exist or might exist.
*/
public boolean keyMayExist(ColumnFamilyHandle columnFamilyHandle,
byte[] key, StringBuffer value){
public boolean keyMayExist(final ColumnFamilyHandle columnFamilyHandle,
final byte[] key, final StringBuffer value){
return keyMayExist(key, key.length, columnFamilyHandle.nativeHandle_,
value);
}
@ -501,8 +504,8 @@ public class RocksDB extends RocksObject {
* found in block-cache.
* @return boolean value indicating if key does not exist or might exist.
*/
public boolean keyMayExist(ReadOptions readOptions,
byte[] key, StringBuffer value){
public boolean keyMayExist(final ReadOptions readOptions,
final byte[] key, final StringBuffer value){
return keyMayExist(readOptions.nativeHandle_,
key, key.length, value);
}
@ -521,8 +524,9 @@ public class RocksDB extends RocksObject {
* found in block-cache.
* @return boolean value indicating if key does not exist or might exist.
*/
public boolean keyMayExist(ReadOptions readOptions,
ColumnFamilyHandle columnFamilyHandle, byte[] key, StringBuffer value){
public boolean keyMayExist(final ReadOptions readOptions,
final ColumnFamilyHandle columnFamilyHandle, final byte[] key,
final StringBuffer value){
return keyMayExist(readOptions.nativeHandle_,
key, key.length, columnFamilyHandle.nativeHandle_,
value);
@ -537,7 +541,7 @@ public class RocksDB extends RocksObject {
* @throws RocksDBException thrown if error happens in underlying
* native library.
*/
public void write(WriteOptions writeOpts, WriteBatch updates)
public void write(final WriteOptions writeOpts, final WriteBatch updates)
throws RocksDBException {
write0(writeOpts.nativeHandle_, updates.nativeHandle_);
}
@ -551,8 +555,8 @@ public class RocksDB extends RocksObject {
* @throws RocksDBException thrown if error happens in underlying
* native library.
*/
public void write(WriteOptions writeOpts, WriteBatchWithIndex updates)
throws RocksDBException {
public void write(final WriteOptions writeOpts,
final WriteBatchWithIndex updates) throws RocksDBException {
write1(writeOpts.nativeHandle_, updates.nativeHandle_);
}
@ -566,7 +570,7 @@ public class RocksDB extends RocksObject {
* @throws RocksDBException thrown if error happens in underlying
* native library.
*/
public void merge(byte[] key, byte[] value) throws RocksDBException {
public void merge(final byte[] key, final byte[] value) throws RocksDBException {
merge(nativeHandle_, key, key.length, value, value.length);
}
@ -581,8 +585,8 @@ public class RocksDB extends RocksObject {
* @throws RocksDBException thrown if error happens in underlying
* native library.
*/
public void merge(ColumnFamilyHandle columnFamilyHandle, byte[] key,
byte[] value) throws RocksDBException {
public void merge(final ColumnFamilyHandle columnFamilyHandle,
final byte[] key, final byte[] value) throws RocksDBException {
merge(nativeHandle_, key, key.length, value, value.length,
columnFamilyHandle.nativeHandle_);
}
@ -598,8 +602,8 @@ public class RocksDB extends RocksObject {
* @throws RocksDBException thrown if error happens in underlying
* native library.
*/
public void merge(WriteOptions writeOpts, byte[] key, byte[] value)
throws RocksDBException {
public void merge(final WriteOptions writeOpts, final byte[] key,
final byte[] value) throws RocksDBException {
merge(nativeHandle_, writeOpts.nativeHandle_,
key, key.length, value, value.length);
}
@ -616,9 +620,9 @@ public class RocksDB extends RocksObject {
* @throws RocksDBException thrown if error happens in underlying
* native library.
*/
public void merge(ColumnFamilyHandle columnFamilyHandle,
WriteOptions writeOpts, byte[] key, byte[] value)
throws RocksDBException {
public void merge(final ColumnFamilyHandle columnFamilyHandle,
final WriteOptions writeOpts, final byte[] key,
final byte[] value) throws RocksDBException {
merge(nativeHandle_, writeOpts.nativeHandle_,
key, key.length, value, value.length,
columnFamilyHandle.nativeHandle_);
@ -638,7 +642,7 @@ public class RocksDB extends RocksObject {
* @throws RocksDBException thrown if error happens in underlying
* native library.
*/
public int get(byte[] key, byte[] value) throws RocksDBException {
public int get(final byte[] key, final byte[] value) throws RocksDBException {
return get(nativeHandle_, key, key.length, value, value.length);
}
@ -659,8 +663,8 @@ public class RocksDB extends RocksObject {
* @throws RocksDBException thrown if error happens in underlying
* native library.
*/
public int get(ColumnFamilyHandle columnFamilyHandle, byte[] key, byte[] value)
throws RocksDBException, IllegalArgumentException {
public int get(final ColumnFamilyHandle columnFamilyHandle, final byte[] key,
final byte[] value) throws RocksDBException, IllegalArgumentException {
return get(nativeHandle_, key, key.length, value, value.length,
columnFamilyHandle.nativeHandle_);
}
@ -681,8 +685,8 @@ public class RocksDB extends RocksObject {
* @throws RocksDBException thrown if error happens in underlying
* native library.
*/
public int get(ReadOptions opt, byte[] key, byte[] value)
throws RocksDBException {
public int get(final ReadOptions opt, final byte[] key,
final byte[] value) throws RocksDBException {
return get(nativeHandle_, opt.nativeHandle_,
key, key.length, value, value.length);
}
@ -704,8 +708,9 @@ public class RocksDB extends RocksObject {
* @throws RocksDBException thrown if error happens in underlying
* native library.
*/
public int get(ColumnFamilyHandle columnFamilyHandle, ReadOptions opt, byte[] key,
byte[] value) throws RocksDBException {
public int get(final ColumnFamilyHandle columnFamilyHandle,
final ReadOptions opt, final byte[] key, final byte[] value)
throws RocksDBException {
return get(nativeHandle_, opt.nativeHandle_, key, key.length, value,
value.length, columnFamilyHandle.nativeHandle_);
}
@ -722,7 +727,7 @@ public class RocksDB extends RocksObject {
* @throws RocksDBException thrown if error happens in underlying
* native library.
*/
public byte[] get(byte[] key) throws RocksDBException {
public byte[] get(final byte[] key) throws RocksDBException {
return get(nativeHandle_, key, key.length);
}
@ -740,7 +745,7 @@ public class RocksDB extends RocksObject {
* @throws RocksDBException thrown if error happens in underlying
* native library.
*/
public byte[] get(ColumnFamilyHandle columnFamilyHandle, byte[] key)
public byte[] get(final ColumnFamilyHandle columnFamilyHandle, final byte[] key)
throws RocksDBException {
return get(nativeHandle_, key, key.length, columnFamilyHandle.nativeHandle_);
}
@ -758,7 +763,8 @@ public class RocksDB extends RocksObject {
* @throws RocksDBException thrown if error happens in underlying
* native library.
*/
public byte[] get(ReadOptions opt, byte[] key) throws RocksDBException {
public byte[] get(final ReadOptions opt, final byte[] key)
throws RocksDBException {
return get(nativeHandle_, opt.nativeHandle_, key, key.length);
}
@ -777,8 +783,8 @@ public class RocksDB extends RocksObject {
* @throws RocksDBException thrown if error happens in underlying
* native library.
*/
public byte[] get(ColumnFamilyHandle columnFamilyHandle, ReadOptions opt,
byte[] key) throws RocksDBException {
public byte[] get(final ColumnFamilyHandle columnFamilyHandle,
final ReadOptions opt, final byte[] key) throws RocksDBException {
return get(nativeHandle_, opt.nativeHandle_, key, key.length,
columnFamilyHandle.nativeHandle_);
}
@ -793,7 +799,7 @@ public class RocksDB extends RocksObject {
* @throws RocksDBException thrown if error happens in underlying
* native library.
*/
public Map<byte[], byte[]> multiGet(List<byte[]> keys)
public Map<byte[], byte[]> multiGet(final List<byte[]> keys)
throws RocksDBException {
assert(keys.size() != 0);
@ -830,8 +836,8 @@ public class RocksDB extends RocksObject {
* @throws IllegalArgumentException thrown if the size of passed keys is not
* equal to the amount of passed column family handles.
*/
public Map<byte[], byte[]> multiGet(List<ColumnFamilyHandle> columnFamilyHandleList,
List<byte[]> keys) throws RocksDBException, IllegalArgumentException {
public Map<byte[], byte[]> multiGet(final List<ColumnFamilyHandle> columnFamilyHandleList,
final List<byte[]> keys) throws RocksDBException, IllegalArgumentException {
assert(keys.size() != 0);
// Check if key size equals cfList size. If not a exception must be
// thrown. If not a Segmentation fault happens.
@ -863,8 +869,8 @@ public class RocksDB extends RocksObject {
* @throws RocksDBException thrown if error happens in underlying
* native library.
*/
public Map<byte[], byte[]> multiGet(ReadOptions opt, List<byte[]> keys)
throws RocksDBException {
public Map<byte[], byte[]> multiGet(final ReadOptions opt,
final List<byte[]> keys) throws RocksDBException {
assert(keys.size() != 0);
List<byte[]> values = multiGet(
@ -901,9 +907,9 @@ public class RocksDB extends RocksObject {
* @throws IllegalArgumentException thrown if the size of passed keys is not
* equal to the amount of passed column family handles.
*/
public Map<byte[], byte[]> multiGet(ReadOptions opt,
List<ColumnFamilyHandle> columnFamilyHandleList, List<byte[]> keys)
throws RocksDBException {
public Map<byte[], byte[]> multiGet(final ReadOptions opt,
final List<ColumnFamilyHandle> columnFamilyHandleList,
final List<byte[]> keys) throws RocksDBException {
assert(keys.size() != 0);
// Check if key size equals cfList size. If not a exception must be
// thrown. If not a Segmentation fault happens.
@ -936,7 +942,7 @@ public class RocksDB extends RocksObject {
* @throws RocksDBException thrown if error happens in underlying
* native library.
*/
public void remove(byte[] key) throws RocksDBException {
public void remove(final byte[] key) throws RocksDBException {
remove(nativeHandle_, key, key.length);
}
@ -952,7 +958,7 @@ public class RocksDB extends RocksObject {
* @throws RocksDBException thrown if error happens in underlying
* native library.
*/
public void remove(ColumnFamilyHandle columnFamilyHandle, byte[] key)
public void remove(final ColumnFamilyHandle columnFamilyHandle, final byte[] key)
throws RocksDBException {
remove(nativeHandle_, key, key.length, columnFamilyHandle.nativeHandle_);
}
@ -968,7 +974,7 @@ public class RocksDB extends RocksObject {
* @throws RocksDBException thrown if error happens in underlying
* native library.
*/
public void remove(WriteOptions writeOpt, byte[] key)
public void remove(final WriteOptions writeOpt, final byte[] key)
throws RocksDBException {
remove(nativeHandle_, writeOpt.nativeHandle_, key, key.length);
}
@ -986,8 +992,9 @@ public class RocksDB extends RocksObject {
* @throws RocksDBException thrown if error happens in underlying
* native library.
*/
public void remove(ColumnFamilyHandle columnFamilyHandle, WriteOptions writeOpt,
byte[] key) throws RocksDBException {
public void remove(final ColumnFamilyHandle columnFamilyHandle,
final WriteOptions writeOpt, final byte[] key)
throws RocksDBException {
remove(nativeHandle_, writeOpt.nativeHandle_, key, key.length,
columnFamilyHandle.nativeHandle_);
}
@ -1018,8 +1025,8 @@ public class RocksDB extends RocksObject {
* @throws RocksDBException thrown if error happens in underlying
* native library.
*/
public String getProperty(ColumnFamilyHandle columnFamilyHandle, String property)
throws RocksDBException {
public String getProperty(final ColumnFamilyHandle columnFamilyHandle,
final String property) throws RocksDBException {
return getProperty0(nativeHandle_, columnFamilyHandle.nativeHandle_, property,
property.length());
}
@ -1046,7 +1053,7 @@ public class RocksDB extends RocksObject {
* @throws RocksDBException thrown if error happens in underlying
* native library.
*/
public String getProperty(String property) throws RocksDBException {
public String getProperty(final String property) throws RocksDBException {
return getProperty0(nativeHandle_, property, property.length());
}
@ -1072,7 +1079,7 @@ public class RocksDB extends RocksObject {
*
* @throws RocksDBException if an error happens in the underlying native code.
*/
public long getLongProperty(String property) throws RocksDBException {
public long getLongProperty(final String property) throws RocksDBException {
return getLongProperty(nativeHandle_, property, property.length());
}
@ -1100,8 +1107,8 @@ public class RocksDB extends RocksObject {
*
* @throws RocksDBException if an error happens in the underlying native code.
*/
public long getLongProperty(ColumnFamilyHandle columnFamilyHandle, String property)
throws RocksDBException {
public long getLongProperty(final ColumnFamilyHandle columnFamilyHandle,
final String property) throws RocksDBException {
return getLongProperty(nativeHandle_, columnFamilyHandle.nativeHandle_, property,
property.length());
}
@ -1135,7 +1142,7 @@ public class RocksDB extends RocksObject {
* @param readOptions {@link ReadOptions} instance.
* @return instance of iterator object.
*/
public RocksIterator newIterator(ReadOptions readOptions) {
public RocksIterator newIterator(final ReadOptions readOptions) {
return new RocksIterator(this, iterator(nativeHandle_,
readOptions.nativeHandle_));
}
@ -1185,7 +1192,7 @@ public class RocksDB extends RocksObject {
* instance
* @return instance of iterator object.
*/
public RocksIterator newIterator(ColumnFamilyHandle columnFamilyHandle) {
public RocksIterator newIterator(final ColumnFamilyHandle columnFamilyHandle) {
return new RocksIterator(this, iteratorCF(nativeHandle_,
columnFamilyHandle.nativeHandle_));
}
@ -1205,8 +1212,8 @@ public class RocksDB extends RocksObject {
* @param readOptions {@link ReadOptions} instance.
* @return instance of iterator object.
*/
public RocksIterator newIterator(ColumnFamilyHandle columnFamilyHandle,
ReadOptions readOptions) {
public RocksIterator newIterator(final ColumnFamilyHandle columnFamilyHandle,
final ReadOptions readOptions) {
return new RocksIterator(this, iteratorCF(nativeHandle_,
columnFamilyHandle.nativeHandle_, readOptions.nativeHandle_));
}
@ -1225,7 +1232,7 @@ public class RocksDB extends RocksObject {
* native library.
*/
public List<RocksIterator> newIterators(
List<ColumnFamilyHandle> columnFamilyHandleList) throws RocksDBException {
final List<ColumnFamilyHandle> columnFamilyHandleList) throws RocksDBException {
return newIterators(columnFamilyHandleList, new ReadOptions());
}
@ -1244,8 +1251,8 @@ public class RocksDB extends RocksObject {
* native library.
*/
public List<RocksIterator> newIterators(
List<ColumnFamilyHandle> columnFamilyHandleList,
ReadOptions readOptions) throws RocksDBException {
final List<ColumnFamilyHandle> columnFamilyHandleList,
final ReadOptions readOptions) throws RocksDBException {
List<RocksIterator> iterators =
new ArrayList<>(columnFamilyHandleList.size());
@ -1278,7 +1285,7 @@ public class RocksDB extends RocksObject {
* native library.
*/
public ColumnFamilyHandle createColumnFamily(
ColumnFamilyDescriptor columnFamilyDescriptor)
final ColumnFamilyDescriptor columnFamilyDescriptor)
throws RocksDBException {
return new ColumnFamilyHandle(this, createColumnFamily(nativeHandle_,
columnFamilyDescriptor));
@ -1295,7 +1302,7 @@ public class RocksDB extends RocksObject {
* @throws RocksDBException thrown if error happens in underlying
* native library.
*/
public void dropColumnFamily(ColumnFamilyHandle columnFamilyHandle)
public void dropColumnFamily(final ColumnFamilyHandle columnFamilyHandle)
throws RocksDBException, IllegalArgumentException {
// throws RocksDBException if something goes wrong
dropColumnFamily(nativeHandle_, columnFamilyHandle.nativeHandle_);
@ -1314,7 +1321,7 @@ public class RocksDB extends RocksObject {
* @throws RocksDBException thrown if an error occurs within the native
* part of the library.
*/
public void flush(FlushOptions flushOptions)
public void flush(final FlushOptions flushOptions)
throws RocksDBException {
flush(nativeHandle_, flushOptions.nativeHandle_);
}
@ -1331,8 +1338,8 @@ public class RocksDB extends RocksObject {
* @throws RocksDBException thrown if an error occurs within the native
* part of the library.
*/
public void flush(FlushOptions flushOptions,
ColumnFamilyHandle columnFamilyHandle) throws RocksDBException {
public void flush(final FlushOptions flushOptions,
final ColumnFamilyHandle columnFamilyHandle) throws RocksDBException {
flush(nativeHandle_, flushOptions.nativeHandle_,
columnFamilyHandle.nativeHandle_);
}
@ -1376,7 +1383,7 @@ public class RocksDB extends RocksObject {
* @throws RocksDBException thrown if an error occurs within the native
* part of the library.
*/
public void compactRange(byte[] begin, byte[] end)
public void compactRange(final byte[] begin, final byte[] end)
throws RocksDBException {
compactRange0(nativeHandle_, begin, begin.length, end,
end.length, false, -1, 0);
@ -1406,8 +1413,9 @@ public class RocksDB extends RocksObject {
* @throws RocksDBException thrown if an error occurs within the native
* part of the library.
*/
public void compactRange(boolean reduce_level, int target_level,
int target_path_id) throws RocksDBException {
public void compactRange(final boolean reduce_level,
final int target_level, final int target_path_id)
throws RocksDBException {
compactRange0(nativeHandle_, reduce_level,
target_level, target_path_id);
}
@ -1439,9 +1447,9 @@ public class RocksDB extends RocksObject {
* @throws RocksDBException thrown if an error occurs within the native
* part of the library.
*/
public void compactRange(byte[] begin, byte[] end,
boolean reduce_level, int target_level, int target_path_id)
throws RocksDBException {
public void compactRange(final byte[] begin, final byte[] end,
final boolean reduce_level, final int target_level,
final int target_path_id) throws RocksDBException {
compactRange0(nativeHandle_, begin, begin.length, end, end.length,
reduce_level, target_level, target_path_id);
}
@ -1472,7 +1480,7 @@ public class RocksDB extends RocksObject {
* @throws RocksDBException thrown if an error occurs within the native
* part of the library.
*/
public void compactRange(ColumnFamilyHandle columnFamilyHandle)
public void compactRange(final ColumnFamilyHandle columnFamilyHandle)
throws RocksDBException {
compactRange(nativeHandle_, false, -1, 0,
columnFamilyHandle.nativeHandle_);
@ -1504,8 +1512,8 @@ public class RocksDB extends RocksObject {
* @throws RocksDBException thrown if an error occurs within the native
* part of the library.
*/
public void compactRange(ColumnFamilyHandle columnFamilyHandle,
byte[] begin, byte[] end) throws RocksDBException {
public void compactRange(final ColumnFamilyHandle columnFamilyHandle,
final byte[] begin, final byte[] end) throws RocksDBException {
compactRange(nativeHandle_, begin, begin.length, end, end.length,
false, -1, 0, columnFamilyHandle.nativeHandle_);
}
@ -1541,9 +1549,9 @@ public class RocksDB extends RocksObject {
* @throws RocksDBException thrown if an error occurs within the native
* part of the library.
*/
public void compactRange(ColumnFamilyHandle columnFamilyHandle,
boolean reduce_level, int target_level, int target_path_id)
throws RocksDBException {
public void compactRange(final ColumnFamilyHandle columnFamilyHandle,
final boolean reduce_level, final int target_level,
final int target_path_id) throws RocksDBException {
compactRange(nativeHandle_, reduce_level, target_level,
target_path_id, columnFamilyHandle.nativeHandle_);
}
@ -1580,9 +1588,10 @@ public class RocksDB extends RocksObject {
* @throws RocksDBException thrown if an error occurs within the native
* part of the library.
*/
public void compactRange(ColumnFamilyHandle columnFamilyHandle,
byte[] begin, byte[] end, boolean reduce_level, int target_level,
int target_path_id) throws RocksDBException {
public void compactRange(final ColumnFamilyHandle columnFamilyHandle,
final byte[] begin, final byte[] end, final boolean reduce_level,
final int target_level, final int target_path_id)
throws RocksDBException {
compactRange(nativeHandle_, begin, begin.length, end, end.length,
reduce_level, target_level, target_path_id,
columnFamilyHandle.nativeHandle_);
@ -1630,7 +1639,7 @@ public class RocksDB extends RocksObject {
* @throws RocksDBException thrown if operation was not performed
* successfully.
*/
public void enableFileDeletions(boolean force)
public void enableFileDeletions(final boolean force)
throws RocksDBException {
enableFileDeletions(nativeHandle_, force);
}
@ -1652,7 +1661,7 @@ public class RocksDB extends RocksObject {
* @throws org.rocksdb.RocksDBException if iterator cannot be retrieved
* from native-side.
*/
public TransactionLogIterator getUpdatesSince(long sequenceNumber)
public TransactionLogIterator getUpdatesSince(final long sequenceNumber)
throws RocksDBException {
return new TransactionLogIterator(
getUpdatesSince(nativeHandle_, sequenceNumber));

View File

@ -15,7 +15,7 @@ public class RocksDBException extends Exception {
*
* @param msg the specified error message.
*/
public RocksDBException(String msg) {
public RocksDBException(final String msg) {
super(msg);
}
}

View File

@ -46,7 +46,7 @@ public class RocksEnv extends RocksObject {
*
* @return current {@link org.rocksdb.RocksEnv} instance.
*/
public RocksEnv setBackgroundThreads(int num) {
public RocksEnv setBackgroundThreads(final int num) {
return setBackgroundThreads(num, FLUSH_POOL);
}
@ -61,7 +61,7 @@ public class RocksEnv extends RocksObject {
* <p>Default number: 1</p>
* @return current {@link org.rocksdb.RocksEnv} instance.
*/
public RocksEnv setBackgroundThreads(int num, int poolID) {
public RocksEnv setBackgroundThreads(final int num, final int poolID) {
setBackgroundThreads(nativeHandle_, num, poolID);
return this;
}
@ -77,7 +77,7 @@ public class RocksEnv extends RocksObject {
*
* @return the thread pool queue length.
*/
public int getThreadPoolQueueLen(int poolID) {
public int getThreadPoolQueueLen(final int poolID) {
return getThreadPoolQueueLen(nativeHandle_, poolID);
}
private native int getThreadPoolQueueLen(long handle, int poolID);
@ -91,7 +91,7 @@ public class RocksEnv extends RocksObject {
* the ownership of the input handle. As a result, calling
* {@code dispose()} of the created RocksEnv will be no-op.</p>
*/
RocksEnv(long handle) {
RocksEnv(final long handle) {
super();
nativeHandle_ = handle;
disOwnNativeHandle();

View File

@ -3,7 +3,7 @@ package org.rocksdb;
/**
* The config for skip-list memtable representation.
*/
public class SkipListMemTableConfig extends MemTableConfig {
public final class SkipListMemTableConfig extends MemTableConfig {
public static final long DEFAULT_LOOKAHEAD = 0;
@ -24,7 +24,7 @@ public class SkipListMemTableConfig extends MemTableConfig {
* seeks with consecutive keys.
* @return the current instance of SkipListMemTableConfig
*/
public SkipListMemTableConfig setLookahead(long lookahead) {
public SkipListMemTableConfig setLookahead(final long lookahead) {
lookahead_ = lookahead;
return this;
}

View File

@ -8,8 +8,8 @@ package org.rocksdb;
/**
* Snapshot of database
*/
public class Snapshot extends RocksObject {
Snapshot(long nativeHandle) {
public final class Snapshot extends RocksObject {
Snapshot(final long nativeHandle) {
super();
nativeHandle_ = nativeHandle;
}

View File

@ -13,7 +13,7 @@ public class Statistics {
private final long statsHandle_;
public Statistics(long statsHandle) {
public Statistics(final long statsHandle) {
statsHandle_ = statsHandle;
}
@ -22,7 +22,7 @@ public class Statistics {
return getTickerCount0(tickerType.getValue(), statsHandle_);
}
public HistogramData geHistogramData(HistogramType histogramType) {
public HistogramData geHistogramData(final HistogramType histogramType) {
assert(isInitialized());
return geHistogramData0(
histogramType.getValue(), statsHandle_);

View File

@ -32,8 +32,9 @@ public class StatisticsCollector {
* @param statsCollectionIntervalInMilliSeconds Statistics collection time
* period (specified in milliseconds).
*/
public StatisticsCollector(List<StatsCollectorInput> statsCollectorInputList,
int statsCollectionIntervalInMilliSeconds) {
public StatisticsCollector(
final List<StatsCollectorInput> statsCollectorInputList,
final int statsCollectionIntervalInMilliSeconds) {
_statsCollectorInputList = statsCollectorInputList;
_statsCollectionInterval = statsCollectionIntervalInMilliSeconds;
@ -51,7 +52,7 @@ public class StatisticsCollector {
* killing the collection process.
* @throws java.lang.InterruptedException thrown if Threads are interrupted.
*/
public void shutDown(int shutdownTimeout) throws InterruptedException {
public void shutDown(final int shutdownTimeout) throws InterruptedException {
_isRunning = false;
_executorService.shutdownNow();

View File

@ -19,8 +19,8 @@ public class StatsCollectorInput {
* @param statistics Reference of DB statistics.
* @param statsCallback Reference of statistics callback interface.
*/
public StatsCollectorInput(Statistics statistics,
StatisticsCollectorCallback statsCallback) {
public StatsCollectorInput(final Statistics statistics,
final StatisticsCollectorCallback statsCallback) {
_statistics = statistics;
_statsCallback = statsCallback;
}

View File

@ -5,7 +5,7 @@ package org.rocksdb;
* One run of the iterator is continuous, i.e. the iterator will stop at the
* beginning of any gap in sequences.</p>
*/
public class TransactionLogIterator extends RocksObject {
public final class TransactionLogIterator extends RocksObject {
/**
* <p>An iterator is either positioned at a WriteBatch
@ -56,7 +56,7 @@ public class TransactionLogIterator extends RocksObject {
*
* @param nativeHandle address to native address.
*/
TransactionLogIterator(long nativeHandle) {
TransactionLogIterator(final long nativeHandle) {
super();
nativeHandle_ = nativeHandle;
}
@ -70,7 +70,7 @@ public class TransactionLogIterator extends RocksObject {
* by a TransactionLogIterator containing a sequence
* number and a {@link WriteBatch} instance.</p>
*/
public class BatchResult {
public final class BatchResult {
/**
* <p>Constructor of BatchResult class.</p>
*
@ -78,7 +78,8 @@ public class TransactionLogIterator extends RocksObject {
* @param nativeHandle to {@link org.rocksdb.WriteBatch}
* native instance.
*/
public BatchResult(long sequenceNumber, long nativeHandle) {
public BatchResult(final long sequenceNumber,
final long nativeHandle) {
sequenceNumber_ = sequenceNumber;
writeBatch_ = new WriteBatch(nativeHandle);
}

View File

@ -63,7 +63,7 @@ public class TtlDB extends RocksDB {
* @throws RocksDBException thrown if an error occurs within the native
* part of the library.
*/
public static TtlDB open(Options options, String db_path)
public static TtlDB open(final Options options, final String db_path)
throws RocksDBException {
return open(options, db_path, 0, false);
}
@ -82,8 +82,8 @@ public class TtlDB extends RocksDB {
* @throws RocksDBException thrown if an error occurs within the native
* part of the library.
*/
public static TtlDB open(Options options, String db_path, int ttl,
boolean readOnly) throws RocksDBException {
public static TtlDB open(final Options options, final String db_path,
final int ttl, final boolean readOnly) throws RocksDBException {
TtlDB ttldb = new TtlDB();
ttldb.open(options.nativeHandle_, db_path, ttl, readOnly);
return ttldb;
@ -108,10 +108,11 @@ public class TtlDB extends RocksDB {
* @throws java.lang.IllegalArgumentException when there is not a ttl value
* per given column family handle.
*/
public static TtlDB open(DBOptions options, String db_path,
List<ColumnFamilyDescriptor> columnFamilyDescriptors,
List<ColumnFamilyHandle> columnFamilyHandles,
List<Integer> ttlValues, boolean readOnly) throws RocksDBException {
public static TtlDB open(final DBOptions options, final String db_path,
final List<ColumnFamilyDescriptor> columnFamilyDescriptors,
final List<ColumnFamilyHandle> columnFamilyHandles,
final List<Integer> ttlValues, final boolean readOnly)
throws RocksDBException {
if (columnFamilyDescriptors.size() != ttlValues.size()) {
throw new IllegalArgumentException("There must be a ttl value per column" +
"family handle.");
@ -143,8 +144,8 @@ public class TtlDB extends RocksDB {
* native library.
*/
public ColumnFamilyHandle createColumnFamilyWithTtl(
ColumnFamilyDescriptor columnFamilyDescriptor, int ttl)
throws RocksDBException {
final ColumnFamilyDescriptor columnFamilyDescriptor,
final int ttl) throws RocksDBException {
assert(isInitialized());
return new ColumnFamilyHandle(this,
createColumnFamilyWithTtl(nativeHandle_,

View File

@ -3,7 +3,7 @@ package org.rocksdb;
/**
* The config for vector memtable representation.
*/
public class VectorMemTableConfig extends MemTableConfig {
public final class VectorMemTableConfig extends MemTableConfig {
public static final int DEFAULT_RESERVED_SIZE = 0;
/**
@ -20,7 +20,7 @@ public class VectorMemTableConfig extends MemTableConfig {
* @param size the initial size of the vector.
* @return the reference to the current config.
*/
public VectorMemTableConfig setReservedSize(int size) {
public VectorMemTableConfig setReservedSize(final int size) {
reservedSize_ = size;
return this;
}

View File

@ -8,7 +8,7 @@ package org.rocksdb;
public class WBWIRocksIterator extends AbstractRocksIterator<WriteBatchWithIndex> {
private final WriteEntry entry = new WriteEntry();
protected WBWIRocksIterator(WriteBatchWithIndex wbwi, long nativeHandle) {
protected WBWIRocksIterator(final WriteBatchWithIndex wbwi, final long nativeHandle) {
super(wbwi, nativeHandle);
}

View File

@ -36,7 +36,7 @@ public class WriteBatch extends AbstractWriteBatch {
*
* @param reserved_bytes reserved size for WriteBatch
*/
public WriteBatch(int reserved_bytes) {
public WriteBatch(final int reserved_bytes) {
nativeHandle_ = 0;
newWriteBatch(reserved_bytes);
}
@ -49,7 +49,7 @@ public class WriteBatch extends AbstractWriteBatch {
*
* @throws RocksDBException If we cannot iterate over the batch
*/
public void iterate(Handler handler) throws RocksDBException {
public void iterate(final Handler handler) throws RocksDBException {
iterate(handler.nativeHandle_);
}
@ -60,7 +60,7 @@ public class WriteBatch extends AbstractWriteBatch {
*
* @param nativeHandle address of native instance.
*/
WriteBatch(long nativeHandle) {
WriteBatch(final long nativeHandle) {
super();
disOwnNativeHandle();
nativeHandle_ = nativeHandle;

View File

@ -40,7 +40,7 @@ public class WriteBatchWithIndex extends AbstractWriteBatch {
* inserting a duplicate key, in this way an iterator will never
* show two entries with the same key.
*/
public WriteBatchWithIndex(boolean overwriteKey) {
public WriteBatchWithIndex(final boolean overwriteKey) {
super();
newWriteBatchWithIndex(overwriteKey);
}
@ -58,8 +58,8 @@ public class WriteBatchWithIndex extends AbstractWriteBatch {
* inserting a duplicate key, in this way an iterator will never
* show two entries with the same key.
*/
public WriteBatchWithIndex(AbstractComparator<? extends AbstractSlice<?>>
fallbackIndexComparator, int reservedBytes, boolean overwriteKey) {
public WriteBatchWithIndex(final AbstractComparator<? extends AbstractSlice<?>>
fallbackIndexComparator, final int reservedBytes, final boolean overwriteKey) {
super();
newWriteBatchWithIndex(fallbackIndexComparator.nativeHandle_, reservedBytes, overwriteKey);
}
@ -75,7 +75,7 @@ public class WriteBatchWithIndex extends AbstractWriteBatch {
* @param columnFamilyHandle The column family to iterate over
* @return An iterator for the Write Batch contents, restricted to the column family
*/
public WBWIRocksIterator newIterator(ColumnFamilyHandle columnFamilyHandle) {
public WBWIRocksIterator newIterator(final ColumnFamilyHandle columnFamilyHandle) {
return new WBWIRocksIterator(this, iterator1(columnFamilyHandle.nativeHandle_));
}
@ -103,8 +103,8 @@ public class WriteBatchWithIndex extends AbstractWriteBatch {
* @return An iterator which shows a view comprised of both the database point-in-time
* from baseIterator and modifications made in this write batch.
*/
public RocksIterator newIteratorWithBase(ColumnFamilyHandle columnFamilyHandle,
RocksIterator baseIterator) {
public RocksIterator newIteratorWithBase(final ColumnFamilyHandle columnFamilyHandle,
final RocksIterator baseIterator) {
RocksIterator iterator = new RocksIterator(
baseIterator.parent_,
iteratorWithBase(columnFamilyHandle.nativeHandle_, baseIterator.nativeHandle_));
@ -122,7 +122,7 @@ public class WriteBatchWithIndex extends AbstractWriteBatch {
* @return An iterator which shows a view comprised of both the database point-in-time
* from baseIterator and modifications made in this write batch.
*/
public RocksIterator newIteratorWithBase(RocksIterator baseIterator) {
public RocksIterator newIteratorWithBase(final RocksIterator baseIterator) {
return newIteratorWithBase(baseIterator.parent_.getDefaultColumnFamily(), baseIterator);
}

View File

@ -11,7 +11,7 @@ package org.rocksdb;
* Note that developers should call WriteOptions.dispose() to release the
* c++ side memory before a WriteOptions instance runs out of scope.
*/
public class WriteOptions extends RocksObject {
public final class WriteOptions extends RocksObject {
/**
* Construct WriteOptions instance.
*/
@ -47,7 +47,7 @@ public class WriteOptions extends RocksObject {
* should be synchronized.
* @return the instance of the current WriteOptions.
*/
public WriteOptions setSync(boolean flag) {
public WriteOptions setSync(final boolean flag) {
setSync(nativeHandle_, flag);
return this;
}
@ -82,7 +82,7 @@ public class WriteOptions extends RocksObject {
* write-ahead-log on writes.
* @return the instance of the current WriteOptions.
*/
public WriteOptions setDisableWAL(boolean flag) {
public WriteOptions setDisableWAL(final boolean flag) {
setDisableWAL(nativeHandle_, flag);
return this;
}

View File

@ -1,6 +1,6 @@
package org.rocksdb.util;
public class Environment {
public final class Environment {
private static String OS = System.getProperty("os.name").toLowerCase();
private static String ARCH = System.getProperty("os.arch").toLowerCase();
@ -22,11 +22,11 @@ public class Environment {
return (ARCH.indexOf("64") > 0);
}
public static String getSharedLibraryName(String name) {
public static String getSharedLibraryName(final String name) {
return name + "jni";
}
public static String getSharedLibraryFileName(String name) {
public static String getSharedLibraryFileName(final String name) {
return appendLibOsSuffix("lib" + getSharedLibraryName(name), true);
}

View File

@ -5,7 +5,7 @@
package org.rocksdb.util;
public class SizeUnit {
public final class SizeUnit {
public static final long KB = 1024L;
public static final long MB = KB * KB;
public static final long GB = KB * MB;