=clt #16948 Use min retries for singleton leaving scenario"

* In 2.4 we derive the number of hand-over/take-over retries from
  the removal margin, but we decided to set that to 0 by default, since
  it is intended for network partition scenarios. maxTakeOverRetries
  became 1. So there must be also be a  min number of retries property.
* The test failed for the leaving scenario because the singleton
  instance was stopped hard without sending the terminationMessage when
  the maxTakeOverRetries was exceeded.
This commit is contained in:
Patrik Nordwall 2015-09-16 14:51:00 +02:00
parent c57b4e24c8
commit 6d036ca00c
3 changed files with 20 additions and 2 deletions

View file

@ -115,15 +115,21 @@ object ClusterSingletonManagerSpec extends MultiNodeConfig {
/**
* The Singleton actor
*/
class Consumer(queue: ActorRef, delegateTo: ActorRef) extends Actor {
class Consumer(queue: ActorRef, delegateTo: ActorRef) extends Actor with ActorLogging {
import Consumer._
import PointToPointChannel._
var current = 0
var stoppedBeforeUnregistration = true
override def preStart(): Unit = queue ! RegisterConsumer
override def postStop(): Unit = {
if (stoppedBeforeUnregistration)
log.warning("Stopped before unregistration")
}
def receive = {
case n: Int if n <= current
context.stop(self)
@ -138,6 +144,7 @@ object ClusterSingletonManagerSpec extends MultiNodeConfig {
case End
queue ! UnregisterConsumer
case UnregistrationOk
stoppedBeforeUnregistration = false
context stop self
case Ping
sender() ! Pong