X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-akka-raft%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fraft%2FRaftActor.java;h=2bd75923d9a06c24a34f506ab2b4574263ab6f0a;hp=610a7d8f2f886d6ad94c8c80b0a8ca633e02214a;hb=135129e0cca66040fd512fab740d59b2ab1f8382;hpb=204f45f8b3233dbea87e2c8065914f0d2a0ded07 diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActor.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActor.java index 610a7d8f2f..2bd75923d9 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActor.java +++ b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActor.java @@ -316,9 +316,14 @@ public abstract class RaftActor extends AbstractUntypedPersistentActor { } }); } else if(currentBehavior.state() == RaftState.Leader) { - pauseLeader(new Runnable() { + pauseLeader(new TimedRunnable(context.getConfigParams().getElectionTimeOutInterval(), this) { @Override - public void run() { + protected void doRun() { + self().tell(PoisonPill.getInstance(), self()); + } + + @Override + protected void doCancel() { self().tell(PoisonPill.getInstance(), self()); } }); @@ -723,8 +728,9 @@ public abstract class RaftActor extends AbstractUntypedPersistentActor { /** * This method is called prior to operations such as leadership transfer and actor shutdown when the leader * must pause or stop its duties. This method allows derived classes to gracefully pause or finish current - * work prior to performing the operation. On completion of any work, the run method must be called to - * proceed with the given operation. + * work prior to performing the operation. On completion of any work, the run method must be called on the + * given Runnable to proceed with the given operation. Important: the run method must be called on + * this actor's thread dispatcher as as it modifies internal state. *

* The default implementation immediately runs the operation. *