merlimat commented on code in PR #22585:
URL: https://github.com/apache/pulsar/pull/22585#discussion_r1581199791
##########
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/batching/AbstractBatchedMetadataStore.java:
##########
@@ -99,7 +103,13 @@ public void close() throws Exception {
private void flush() {
while (!readOps.isEmpty()) {
List<MetadataOp> ops = new ArrayList<>();
- readOps.drain(ops::add, maxOperations);
+ for (int i = 0; i < maxOperations; i++) {
Review Comment:
This one should be ok, since it's already done in a loop: `while
(!readOps.isEmpty()) {...}`
##########
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/batching/AbstractBatchedMetadataStore.java:
##########
@@ -87,9 +87,13 @@ public void close() throws Exception {
// Fail all the pending items
MetadataStoreException ex =
new
MetadataStoreException.AlreadyClosedException("Metadata store is getting
closed");
- readOps.drain(op -> op.getFuture().completeExceptionally(ex));
- writeOps.drain(op -> op.getFuture().completeExceptionally(ex));
-
+ MetadataOp op;
+ while ((op = readOps.poll()) != null) {
+ op.getFuture().completeExceptionally(ex);
+ }
+ while ((op = writeOps.poll()) != null) {
+ op.getFuture().completeExceptionally(ex);
+ }
Review Comment:
👍
--
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]