Technoboy- commented on code in PR #17056:
URL: https://github.com/apache/pulsar/pull/17056#discussion_r944222422
##########
tiered-storage/jcloud/src/main/java/org/apache/bookkeeper/mledger/offload/jcloud/impl/BlobStoreBackedReadHandleImplV2.java:
##########
@@ -135,13 +144,20 @@ public CompletableFuture<Void> closeAsync() {
public CompletableFuture<LedgerEntries> readAsync(long firstEntry, long
lastEntry) {
log.debug("Ledger {}: reading {} - {}", getId(), firstEntry,
lastEntry);
CompletableFuture<LedgerEntries> promise = new CompletableFuture<>();
- if (firstEntry > lastEntry
- || firstEntry < 0
- || lastEntry > getLastAddConfirmed()) {
- promise.completeExceptionally(new IllegalArgumentException());
- return promise;
- }
executor.execute(() -> {
+ if (state == State.Closed) {
+ log.warn("Reading a closed read handler. Ledger ID: {}, Read
range: {}-{}",
+ ledgerId, firstEntry, lastEntry);
+ promise.completeExceptionally(new
ManagedLedgerException.OffloadReadHandleClosedException());
+ return;
+ }
+
+ if (firstEntry > lastEntry
+ || firstEntry < 0
+ || lastEntry > getLastAddConfirmed()) {
+ promise.completeExceptionally(new IllegalArgumentException());
Review Comment:
Should we use the same exception `BKIncorrectParameterException` with v1 or
both use `IllegalArgumentException` ?
--
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]