Code cleanup

This commit is contained in:
Andrea Cavalli 2022-05-02 19:05:40 +02:00
parent 19bb638f20
commit 614d24ac8d

View File

@ -1003,29 +1003,26 @@ public class LLLocalKeyValueDatabase implements LLKeyValueDatabase {
@Override @Override
public Mono<LLLocalDictionary> getDictionary(byte[] columnName, UpdateMode updateMode) { public Mono<LLLocalDictionary> getDictionary(byte[] columnName, UpdateMode updateMode) {
return Mono return Mono.fromCallable(() -> {
.fromCallable(() -> { var closeReadLock = closeLock.readLock();
var closeReadLock = closeLock.readLock(); try {
try { ensureOpen();
ensureOpen(); var cfh = getCfh(columnName);
var cfh = getCfh(columnName); ensureOwned(cfh);
ensureOwned(cfh); return new LLLocalDictionary(allocator,
return new LLLocalDictionary( getRocksDBColumn(db, cfh),
allocator, name,
getRocksDBColumn(db, cfh), ColumnUtils.toString(columnName),
name, dbWScheduler,
ColumnUtils.toString(columnName), dbRScheduler,
dbWScheduler, this::getSnapshotLambda,
dbRScheduler, updateMode,
this::getSnapshotLambda, databaseOptions
updateMode, );
databaseOptions } finally {
); closeLock.unlockRead(closeReadLock);
} finally { }
closeLock.unlockRead(closeReadLock); }).subscribeOn(dbRScheduler);
}
})
.subscribeOn(dbRScheduler);
} }
public RocksDBColumn getRocksDBColumn(byte[] columnName) { public RocksDBColumn getRocksDBColumn(byte[] columnName) {