BUG-5626: refactor BehaviorStateHolder 20/37020/2
authorRobert Varga <rovarga@cisco.com>
Fri, 1 Apr 2016 20:08:10 +0000 (22:08 +0200)
committerRobert Varga <rovarga@cisco.com>
Sat, 2 Apr 2016 13:23:33 +0000 (15:23 +0200)
commit3676d1686706dbee6656e86a23c4bdb516d5267b
tree9398bc7a9a78b0e52b7420b5265e1772be34eba7
parent55d229e2b83b1a48a43cc1e01c90f5be7d02faf0
BUG-5626: refactor BehaviorStateHolder

This patch splits this class into two parts: BehaviorStateTracker, which is kept
around for as long as RaftActor lives, and BehaviorState, which is used transiently
when we are about to perform a state change.

This makes it more clear as to what state is required to perform a behavior change
and also prevents us from keeping potentially stale objects around. While it forces
object allocation in message dispatch, BehaviorState objects are extremely short-lived
and do not leak to the help -- hence JVMs should be able to deal with them quickly
during GC or even eliminate allocations based on escape analysis.

Change-Id: Ida23a0dcb75ab6ccd11afcc64742884214760549
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActor.java