diff --git a/tiered-storage/jcloud/src/main/java/org/apache/bookkeeper/mledger/offload/jcloud/impl/BlobStoreManagedLedgerOffloader.java b/tiered-storage/jcloud/src/main/java/org/apache/bookkeeper/mledger/offload/jcloud/impl/BlobStoreManagedLedgerOffloader.java index b4ed940c9cdca..d6d298159ea22 100644 --- a/tiered-storage/jcloud/src/main/java/org/apache/bookkeeper/mledger/offload/jcloud/impl/BlobStoreManagedLedgerOffloader.java +++ b/tiered-storage/jcloud/src/main/java/org/apache/bookkeeper/mledger/offload/jcloud/impl/BlobStoreManagedLedgerOffloader.java @@ -98,6 +98,7 @@ public class BlobStoreManagedLedgerOffloader implements LedgerOffloader { private final OrderedScheduler scheduler; private final TieredStorageConfiguration config; + private final OffloadPolicies policies; private final Location writeLocation; // metadata to be stored as part of the offloaded ledger metadata @@ -105,8 +106,8 @@ public class BlobStoreManagedLedgerOffloader implements LedgerOffloader { private final ConcurrentMap blobStores = new ConcurrentHashMap<>(); private OffloadSegmentInfoImpl segmentInfo; - private AtomicLong bufferLength = new AtomicLong(0); - private AtomicLong segmentLength = new AtomicLong(0); + private final AtomicLong bufferLength = new AtomicLong(0); + private final AtomicLong segmentLength = new AtomicLong(0); private final long maxBufferLength; private final OffsetsCache entryOffsetsCache; private final ConcurrentLinkedQueue offloadBuffer = new ConcurrentLinkedQueue<>(); @@ -138,6 +139,9 @@ public static BlobStoreManagedLedgerOffloader create(TieredStorageConfiguration this.scheduler = scheduler; this.userMetadata = userMetadata; this.config = config; + Properties properties = new Properties(); + properties.putAll(config.getConfigProperties()); + this.policies = OffloadPoliciesImpl.create(properties); this.streamingBlockSize = config.getMinBlockSizeInBytes(); this.maxSegmentCloseTime = Duration.ofSeconds(config.getMaxSegmentTimeInSecond()); this.maxSegmentLength = config.getMaxSegmentSizeInBytes(); @@ -658,9 +662,7 @@ public CompletableFuture deleteOffloaded(UUID uid, Map off @Override public OffloadPolicies getOffloadPolicies() { - Properties properties = new Properties(); - properties.putAll(config.getConfigProperties()); - return OffloadPoliciesImpl.create(properties); + return this.policies; } @Override