Reduce number of hashmap sections for ledger handles cache
@@ -117,7 +117,6 @@ import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.util.Recycler;
import io.netty.util.Recycler.Handle;
-import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import static org.apache.bookkeeper.mledger.impl.ManagedCursorImpl.TRUE;
import static org.apache.bookkeeper.mledger.impl.ManagedCursorImpl.FALSE;
@@ -137,7 +136,8 @@ public class ManagedLedgerImpl implements ManagedLedger, CreateCallback {
protected ManagedLedgerConfig config;
protected final MetaStore store;
- private final ConcurrentLongHashMap<CompletableFuture<ReadHandle>> ledgerCache = new ConcurrentLongHashMap<>();
+ private final ConcurrentLongHashMap<CompletableFuture<ReadHandle>> ledgerCache = new ConcurrentLongHashMap<>(
+ 16 /* initial capacity */, 1 /* number of sections */);
protected final NavigableMap<Long, LedgerInfo> ledgers = new ConcurrentSkipListMap<>();
private volatile Stat ledgersStat;
