From 944509fc25167fc52815673b01a7b03295628711 Mon Sep 17 00:00:00 2001 From: anew Date: Thu, 31 Aug 2017 15:41:10 -0700 Subject: [PATCH] [TEPHRA-242] Ensure Pruning Service shuts down --- .../org/apache/tephra/distributed/TransactionService.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tephra-core/src/main/java/org/apache/tephra/distributed/TransactionService.java b/tephra-core/src/main/java/org/apache/tephra/distributed/TransactionService.java index d4a0f877..f95e5b3b 100644 --- a/tephra-core/src/main/java/org/apache/tephra/distributed/TransactionService.java +++ b/tephra-core/src/main/java/org/apache/tephra/distributed/TransactionService.java @@ -121,15 +121,15 @@ public void failed(State from, Throwable failure) { @Override public void follower() { ListenableFuture stopFuture = null; + if (pruningService != null && pruningService.isRunning()) { + // Wait for pruning service to stop after un-registering from discovery + stopFuture = pruningService.stop(); + } // First stop the transaction server as un-registering from discovery can block sometimes. // That can lead to multiple transaction servers being active at the same time. if (server != null && server.isRunning()) { server.stopAndWait(); } - if (pruningService != null && pruningService.isRunning()) { - // Wait for pruning service to stop after un-registering from discovery - stopFuture = pruningService.stop(); - } undoRegister(); if (stopFuture != null) {