From 4bf262a137cdd3f29272d6f29cf61451c600bbb8 Mon Sep 17 00:00:00 2001 From: Patrik Nordwall Date: Wed, 1 Jul 2015 14:39:20 +0200 Subject: [PATCH] =clu #17712 Guard against readView not created * readView might be null if Cluster init fails before it is created, i.e. shutdown is called from constructor --- akka-cluster/src/main/scala/akka/cluster/Cluster.scala | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/akka-cluster/src/main/scala/akka/cluster/Cluster.scala b/akka-cluster/src/main/scala/akka/cluster/Cluster.scala index 809e915333..a61c0dbdb1 100644 --- a/akka-cluster/src/main/scala/akka/cluster/Cluster.scala +++ b/akka-cluster/src/main/scala/akka/cluster/Cluster.scala @@ -164,7 +164,7 @@ class Cluster(val system: ExtendedActorSystem) extends Extension { log.error(e, "Failed to startup Cluster. You can try to increase 'akka.actor.creation-timeout'.") shutdown() // don't re-throw, that would cause the extension to be re-recreated - // from shutdown() or other places, which may result in + // from shutdown() or other places, which may result in // InvalidActorNameException: actor name [cluster] is not unique system.deadLetters } @@ -362,7 +362,10 @@ class Cluster(val system: ExtendedActorSystem) extends Extension { logInfo("Shutting down...") system.stop(clusterDaemons) - readView.close() + + // readView might be null if init fails before it is created + if (readView != null) + readView.close() closeScheduler()