From 7dbb5e9abb62ee49759b23eef2b56dd1fce35346 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Bone=CC=81r?= Date: Tue, 31 Jan 2012 15:07:15 +0100 Subject: [PATCH] Added try-finally blocks for each shutdown step in the Gossipper.shutdown method. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jonas Bonér --- .../src/main/scala/akka/cluster/Gossiper.scala | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/akka-cluster/src/main/scala/akka/cluster/Gossiper.scala b/akka-cluster/src/main/scala/akka/cluster/Gossiper.scala index c7b4e21773..699ec4c6c8 100644 --- a/akka-cluster/src/main/scala/akka/cluster/Gossiper.scala +++ b/akka-cluster/src/main/scala/akka/cluster/Gossiper.scala @@ -174,11 +174,16 @@ case class Gossiper(remote: RemoteActorRefProvider, system: ActorSystemImpl) { */ def shutdown() { if (isRunning.compareAndSet(true, false)) { - log.info("Shutting down Gossiper for [{}]", address) - connectionManager.shutdown() - system.stop(clusterDaemon) - initateGossipCanceller.cancel() - scrutinizeCanceller.cancel() + log.info("Shutting down Gossiper for [{}]...", address) + try connectionManager.shutdown() finally { + try system.stop(clusterDaemon) finally { + try initateGossipCanceller.cancel() finally { + try scrutinizeCanceller.cancel() finally { + log.info("Gossiper for [{}] is shut down", address) + } + } + } + } } }