Turn ElectionTimeout into a proper singleton
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / behaviors / AbstractRaftActorBehavior.java
index d17fba03d4ba58e77168602ffe388431b0a64a1a..4e2eafcef04343f2c20aa174a23053daacd3b1af 100644 (file)
@@ -38,9 +38,6 @@ import scala.concurrent.duration.FiniteDuration;
  * set currentTerm = T, convert to follower (ยง5.1)
  */
 public abstract class AbstractRaftActorBehavior implements RaftActorBehavior {
-
-    protected static final ElectionTimeout ELECTION_TIMEOUT = new ElectionTimeout();
-
     /**
      * Information about the RaftActor whose behavior this class represents
      */
@@ -267,7 +264,7 @@ public abstract class AbstractRaftActorBehavior implements RaftActorBehavior {
         if(canStartElection()) {
             // Schedule an election. When the scheduler triggers an ElectionTimeout message is sent to itself
             electionCancel = context.getActorSystem().scheduler().scheduleOnce(interval, context.getActor(),
-                    ELECTION_TIMEOUT,context.getActorSystem().dispatcher(), context.getActor());
+                    ElectionTimeout.INSTANCE, context.getActorSystem().dispatcher(), context.getActor());
         }
     }