Skip to content

Commit 38c0beb

Browse files
committed
Use try finally when close
1 parent 01a942d commit 38c0beb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/BrokerRegistryImpl.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -197,16 +197,17 @@ public synchronized void close() throws PulsarServerException {
197197
return;
198198
}
199199
try {
200+
this.listeners.clear();
200201
this.unregister();
201202
this.brokerLookupDataLockManager.close();
202-
this.listeners.clear();
203-
this.state = State.Closed;
204203
} catch (Exception ex) {
205204
if (ex.getCause() instanceof MetadataStoreException.NotFoundException) {
206205
throw new PulsarServerException.NotFoundException(MetadataStoreException.unwrap(ex));
207206
} else {
208207
throw new PulsarServerException(MetadataStoreException.unwrap(ex));
209208
}
209+
} finally {
210+
this.state = State.Closed;
210211
}
211212
}
212213

0 commit comments

Comments
 (0)