Skip to content

Commit

Permalink
[improve][broker] Use shrink map for trackerCache (apache#19534)
Browse files Browse the repository at this point in the history
Signed-off-by: xiaolongran <[email protected]>
  • Loading branch information
wolfstudy authored Feb 16, 2023
1 parent fe547c7 commit c0f89dc
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 c0f89dc

Please sign in to comment.