2121import static org .apache .bookkeeper .mledger .ManagedLedgerException .getManagedLedgerException ;
2222import static org .apache .bookkeeper .mledger .impl .ManagedLedgerImpl .NULL_OFFLOAD_PROMISE ;
2323import static org .apache .pulsar .common .util .Runnables .catchingAndLoggingThrowables ;
24- import com .google .common .annotations .VisibleForTesting ;
2524import com .google .common .base .Predicates ;
2625import com .google .common .collect .BoundType ;
2726import com .google .common .collect .Maps ;
4847import java .util .concurrent .ScheduledExecutorService ;
4948import java .util .concurrent .ScheduledFuture ;
5049import java .util .concurrent .TimeUnit ;
51- import java .util .function .Function ;
5250import java .util .function .Supplier ;
5351import java .util .stream .Collectors ;
5452import lombok .Getter ;
110108import org .apache .pulsar .metadata .api .Stat ;
111109import org .apache .pulsar .metadata .api .extended .MetadataStoreExtended ;
112110import org .apache .pulsar .metadata .api .extended .SessionEvent ;
113- import org .jspecify .annotations .Nullable ;
114111import org .slf4j .Logger ;
115112import org .slf4j .LoggerFactory ;
116113
@@ -173,7 +170,7 @@ public ManagedLedgerFactoryImpl(MetadataStoreExtended metadataStore, ClientConfi
173170 ManagedLedgerFactoryConfig config )
174171 throws Exception {
175172 this (metadataStore , new DefaultBkFactory (bkClientConfiguration ),
176- true /* isBookkeeperManaged */ , config , NullStatsLogger .INSTANCE , OpenTelemetry .noop (), null );
173+ true /* isBookkeeperManaged */ , config , NullStatsLogger .INSTANCE , OpenTelemetry .noop ());
177174 }
178175
179176 public ManagedLedgerFactoryImpl (MetadataStoreExtended metadataStore , BookKeeper bookKeeper )
@@ -187,21 +184,12 @@ public ManagedLedgerFactoryImpl(MetadataStoreExtended metadataStore, BookKeeper
187184 this (metadataStore , (policyConfig ) -> CompletableFuture .completedFuture (bookKeeper ), config );
188185 }
189186
190- @ VisibleForTesting
191- public ManagedLedgerFactoryImpl (MetadataStoreExtended metadataStore , BookKeeper bookKeeper ,
192- @ Nullable Function <ManagedLedgerFactoryImpl , EntryCacheManager >
193- entryCacheManagerCreator )
194- throws Exception {
195- this (metadataStore , __ -> CompletableFuture .completedFuture (bookKeeper ), false ,
196- new ManagedLedgerFactoryConfig (), NullStatsLogger .INSTANCE , OpenTelemetry .noop (),
197- entryCacheManagerCreator );
198- }
199-
200187 public ManagedLedgerFactoryImpl (MetadataStoreExtended metadataStore ,
201188 BookkeeperFactoryForCustomEnsemblePlacementPolicy bookKeeperGroupFactory ,
202189 ManagedLedgerFactoryConfig config )
203190 throws Exception {
204- this (metadataStore , bookKeeperGroupFactory , config , NullStatsLogger .INSTANCE , OpenTelemetry .noop ());
191+ this (metadataStore , bookKeeperGroupFactory , false /* isBookkeeperManaged */ ,
192+ config , NullStatsLogger .INSTANCE , OpenTelemetry .noop ());
205193 }
206194
207195 public ManagedLedgerFactoryImpl (MetadataStoreExtended metadataStore ,
@@ -210,18 +198,15 @@ public ManagedLedgerFactoryImpl(MetadataStoreExtended metadataStore,
210198 OpenTelemetry openTelemetry )
211199 throws Exception {
212200 this (metadataStore , bookKeeperGroupFactory , false /* isBookkeeperManaged */ ,
213- config , statsLogger , openTelemetry , null );
201+ config , statsLogger , openTelemetry );
214202 }
215203
216204 private ManagedLedgerFactoryImpl (MetadataStoreExtended metadataStore ,
217205 BookkeeperFactoryForCustomEnsemblePlacementPolicy bookKeeperGroupFactory ,
218206 boolean isBookkeeperManaged ,
219207 ManagedLedgerFactoryConfig config ,
220208 StatsLogger statsLogger ,
221- OpenTelemetry openTelemetry ,
222- @ Nullable Function <ManagedLedgerFactoryImpl , EntryCacheManager >
223- entryCacheManagerCreator )
224- throws Exception {
209+ OpenTelemetry openTelemetry ) throws Exception {
225210 MetadataCompressionConfig compressionConfigForManagedLedgerInfo =
226211 config .getCompressionConfigForManagedLedgerInfo ();
227212 MetadataCompressionConfig compressionConfigForManagedCursorInfo =
@@ -243,11 +228,7 @@ private ManagedLedgerFactoryImpl(MetadataStoreExtended metadataStore,
243228 compressionConfigForManagedCursorInfo );
244229 this .config = config ;
245230 this .mbean = new ManagedLedgerFactoryMBeanImpl (this );
246- if (entryCacheManagerCreator == null ) {
247- this .entryCacheManager = new RangeEntryCacheManagerImpl (this , scheduledExecutor , openTelemetry );
248- } else {
249- this .entryCacheManager = entryCacheManagerCreator .apply (this );
250- }
231+ this .entryCacheManager = new RangeEntryCacheManagerImpl (this , scheduledExecutor , openTelemetry );
251232 this .statsTask = scheduledExecutor .scheduleWithFixedDelay (catchingAndLoggingThrowables (this ::refreshStats ),
252233 0 , config .getStatsPeriodSeconds (), TimeUnit .SECONDS );
253234 this .flushCursorsTask = scheduledExecutor .scheduleAtFixedRate (catchingAndLoggingThrowables (this ::flushCursors ),
0 commit comments