liangyepianzhou commented on code in PR #16931:
URL: https://github.com/apache/pulsar/pull/16931#discussion_r998151894
##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerFactoryImpl.java:
##########
@@ -420,7 +420,28 @@ public void closeFailed(ManagedLedgerException exception,
Object ctx) {
});
}
-
+ @Override
+ public CompletableFuture<ReadOnlyManagedLedgerImpl>
asyncOpenReadOnlyManagedLedger(String managedLedgerName,
+ ManagedLedgerConfig config, Object ctx) {
+ CompletableFuture<ReadOnlyManagedLedgerImpl> future = new
CompletableFuture<>();
+ if (closed) {
+ return FutureUtil.failedFuture(new
ManagedLedgerException.ManagedLedgerFactoryClosedException());
+ }
+ ReadOnlyManagedLedgerImpl roManagedLedger = new
ReadOnlyManagedLedgerImpl(this,
+ bookkeeperFactory
+ .get(new
EnsemblePlacementPolicyConfig(config.getBookKeeperEnsemblePlacementPolicyClassName(),
+
config.getBookKeeperEnsemblePlacementPolicyProperties())),
+ store, config, scheduledExecutor, managedLedgerName);
+ roManagedLedger.initialize().thenRun(() -> {
+ log.info("[{}] Successfully initialize Read-only managed ledger",
managedLedgerName);
+ future.complete(roManagedLedger);
+ }).exceptionally(e -> {
+ log.error("[{}] Failed to initialize Read-only managed ledger",
managedLedgerName, e);
+ future.completeExceptionally(new
ManagedLedgerException.ManagedLedgerFactoryClosedException());
Review Comment:
It is used in `asyncOpenReadOnlyCursor`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]