properly shutdown ArteryTransport using CoordinatedShutdown, #22671 (#22698)

* properly shutdown ArteryTransport using CoordinatedShutdown, #22671

* The shutdownHook changed hasBeenShutdown flag to true, and then when
  the transport.shutdown was invoked the shutdown sequence was ignored
  until it was too late, ActorSystem already terminated.
* Also improved the cluster shutdown tasks when the cluster node had not
  joined

* CoordinatedShutdownLeave explicit events
This commit is contained in:
Patrik Nordwall 2017-04-11 21:48:51 +02:00 committed by GitHub
parent 193e8beb0a
commit 41c756f169
5 changed files with 34 additions and 17 deletions

View file

@ -299,7 +299,10 @@ private[cluster] class ClusterCoreDaemon(publisher: ActorRef) extends Actor with
val selfExiting = Promise[Done]()
val coordShutdown = CoordinatedShutdown(context.system)
coordShutdown.addTask(CoordinatedShutdown.PhaseClusterExiting, "wait-exiting") { ()
selfExiting.future
if (latestGossip.members.isEmpty)
Future.successful(Done) // not joined yet
else
selfExiting.future
}
coordShutdown.addTask(CoordinatedShutdown.PhaseClusterExitingDone, "exiting-completed") {
val sys = context.system