eolivelli commented on a change in pull request #14524:
URL: https://github.com/apache/pulsar/pull/14524#discussion_r817531242
##########
File path:
pulsar-transaction/coordinator/src/main/java/org/apache/pulsar/transaction/coordinator/impl/MLTransactionMetadataStore.java
##########
@@ -442,15 +444,24 @@ public TransactionCoordinatorStats getCoordinatorStats() {
@Override
public CompletableFuture<Void> closeAsync() {
- return transactionLog.closeAsync().thenCompose(v -> {
- txnMetaMap.clear();
- this.timeoutTracker.close();
- if (!this.changeToCloseState()) {
- return FutureUtil.failedFuture(
- new IllegalStateException("Managed ledger transaction
metadata store state to close error!"));
- }
+ if (changeToClosingState()) {
+ // Disable new tasks from being submitted
+ internalPinnedExecutor.shutdown();
+ return transactionLog.closeAsync().thenCompose(v -> {
+ txnMetaMap.clear();
+ this.timeoutTracker.close();
+ if (!this.changeToCloseState()) {
+ return FutureUtil.failedFuture(
+ new IllegalStateException(
+ "Managed ledger transaction metadata store
state to close error!"));
+ }
+ // Shutdown the ExecutorService
+
MoreExecutors.shutdownAndAwaitTermination(internalPinnedExecutor,
Duration.ofSeconds(5L));
Review comment:
this appears to be a blocking call.
But I can't suggest a better way
##########
File path:
pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java
##########
@@ -446,7 +441,16 @@ public void close() throws PulsarServerException {
List<CompletableFuture<Void>> asyncCloseFutures = new
ArrayList<>();
if (this.brokerService != null) {
- asyncCloseFutures.add(this.brokerService.closeAsync());
+ CompletableFuture<Void> brokerCloseFuture =
this.brokerService.closeAsync();
+ if (this.transactionMetadataStoreService != null) {
+ asyncCloseFutures.add(brokerCloseFuture.thenAccept(__ -> {
Review comment:
should this be "whenComplete" o "handle" ? otherwise in case of failure
we are not executing this code
--
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]