2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.controller.cluster.raft.behaviors;
11 import akka.actor.ActorRef;
12 import org.opendaylight.controller.cluster.raft.RaftState;
15 * A RaftActorBehavior represents the specific behavior of a RaftActor
17 * A RaftActor can behave as one of the following,
20 * <li> Candidate </li>
24 * In each of these behaviors the Raft Actor handles the same Raft messages
27 public interface RaftActorBehavior extends AutoCloseable{
29 * Handle a message. If the processing of the message warrants a state
30 * change then a new state should be returned otherwise this method should
31 * return the state for the current behavior.
33 * @param sender The sender of the message
34 * @param message A message that needs to be processed
36 * @return The new state or self (this)
38 RaftState handleMessage(ActorRef sender, Object message);
41 * The state associated with a given behavior