Skip to content

Commit

Permalink
[improve][broker] Use shrink map for trackerCache (#19534)
Browse files Browse the repository at this point in the history
Signed-off-by: xiaolongran <[email protected]>
(cherry picked from commit c0f89dc)
  • Loading branch information
wolfstudy authored and coderzc committed Mar 1, 2023
1 parent da68adb commit a1d56d2
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,16 @@
import java.util.List;
import org.apache.bookkeeper.mledger.Position;
import org.apache.bookkeeper.mledger.impl.PositionImpl;
import org.apache.bookkeeper.util.collections.ConcurrentLongLongPairHashMap;
import org.apache.bookkeeper.util.collections.ConcurrentLongLongPairHashMap.LongPair;
import org.apache.pulsar.common.util.collections.ConcurrentLongLongPairHashMap;
import org.apache.pulsar.common.util.collections.ConcurrentLongLongPairHashMap.LongPair;

public class InMemoryRedeliveryTracker implements RedeliveryTracker {

private ConcurrentLongLongPairHashMap trackerCache = new ConcurrentLongLongPairHashMap(256, 1);
private ConcurrentLongLongPairHashMap trackerCache = ConcurrentLongLongPairHashMap.newBuilder()
.concurrencyLevel(1)
.expectedItems(256)
.autoShrink(true)
.build();

@Override
public int incrementAndGetRedeliveryCount(Position position) {
Expand Down

0 comments on commit a1d56d2

Please sign in to comment.