clu #17565 Invoke OnMemberRemoved callback when
cluster.shutdown * must also be done when the listener actor stops before the MemberRemoved event has been received * add test for this * clarify docs with example that shuts down actor system and exit jvm
This commit is contained in:
parent
ba8756d485
commit
8a7d7715b5
6 changed files with 60 additions and 13 deletions
|
|
@ -15,6 +15,7 @@ import akka.cluster.InternalClusterAction._
|
|||
import java.lang.management.ManagementFactory
|
||||
import javax.management.ObjectName
|
||||
import akka.actor.ActorRef
|
||||
import akka.testkit.TestProbe
|
||||
|
||||
object ClusterSpec {
|
||||
val config = """
|
||||
|
|
@ -93,12 +94,17 @@ class ClusterSpec extends AkkaSpec(ClusterSpec.config) with ImplicitSender {
|
|||
|
||||
// this should be the last test step, since the cluster is shutdown
|
||||
"publish MemberRemoved when shutdown" in {
|
||||
val callbackProbe = TestProbe()
|
||||
cluster.registerOnMemberRemoved(callbackProbe.ref ! "OnMemberRemoved")
|
||||
|
||||
cluster.subscribe(testActor, classOf[ClusterEvent.MemberRemoved])
|
||||
// first, is in response to the subscription
|
||||
expectMsgClass(classOf[ClusterEvent.CurrentClusterState])
|
||||
|
||||
cluster.shutdown()
|
||||
expectMsgType[ClusterEvent.MemberRemoved].member.address should ===(selfAddress)
|
||||
|
||||
callbackProbe.expectMsg("OnMemberRemoved")
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue