Hide AbstractLeader maps 43/14443/3
authorRobert Varga <rovarga@cisco.com>
Fri, 23 Jan 2015 14:17:31 +0000 (15:17 +0100)
committerRobert Varga <rovarga@cisco.com>
Fri, 23 Jan 2015 22:36:25 +0000 (23:36 +0100)
commit99bbbf312a60e80672a3210881ece8cf73db6520
treecf23b9990eda813ce1888a7ad4af647a926ad5cd
parent1ccea52a9d18baf3d12c70232ba697941f71c7f6
Hide AbstractLeader maps

Collections should never be leaked, as they introduce the ability to
make unsynchronized changes. This patch hides the map itself, allowing
lookups.

Once we have done that, we have control over the interactions and thus
can see that the map is instantiation-constant. Use an ImmutableMap to
maintain the entries as it provides superior compactness and lookup
speeds.

Change-Id: I552372dbabe454111909bb8251637e9f3c0e0db7
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/AbstractLeader.java
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/behaviors/Leader.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/behaviors/LeaderTest.java