From 6b9967fb928329abd91f185951404176a9fb4daa Mon Sep 17 00:00:00 2001 From: Enrico Olivelli Date: Thu, 19 Jan 2023 14:35:00 +0100 Subject: [PATCH] [fix][broker] AbstractBatchedMetadataStore - use AlreadyClosedException instead of IllegalStateException (#19284) (cherry picked from commit d3e112e94ae251fb3ee7668061d336e0400f9a5c) --- .../metadata/impl/batching/AbstractBatchedMetadataStore.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/batching/AbstractBatchedMetadataStore.java b/pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/batching/AbstractBatchedMetadataStore.java index 616cac289efea..31fea0749a88c 100644 --- a/pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/batching/AbstractBatchedMetadataStore.java +++ b/pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/batching/AbstractBatchedMetadataStore.java @@ -30,6 +30,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.pulsar.metadata.api.GetResult; import org.apache.pulsar.metadata.api.MetadataStoreConfig; +import org.apache.pulsar.metadata.api.MetadataStoreException; import org.apache.pulsar.metadata.api.Stat; import org.apache.pulsar.metadata.api.extended.CreateOption; import org.apache.pulsar.metadata.impl.AbstractMetadataStore; @@ -74,7 +75,8 @@ protected AbstractBatchedMetadataStore(MetadataStoreConfig conf) { public void close() throws Exception { if (enabled) { // Fail all the pending items - Exception ex = new IllegalStateException("Metadata store is getting closed"); + MetadataStoreException ex = + new MetadataStoreException.AlreadyClosedException("Metadata store is getting closed"); readOps.drain(op -> op.getFuture().completeExceptionally(ex)); writeOps.drain(op -> op.getFuture().completeExceptionally(ex));