BUG-1120: introduce generations to ListenerMap 92/7592/1
authorRobert Varga <rovarga@cisco.com>
Mon, 2 Jun 2014 11:58:22 +0000 (13:58 +0200)
committerRobert Varga <rovarga@cisco.com>
Mon, 2 Jun 2014 14:17:09 +0000 (16:17 +0200)
commit1c337a8918c2da99b71002e1e80d760954282ee7
tree026dca217b8f20917f00c2f664ea6ca13e883814
parent67ee036916da9ce71eb8303c2f13b52d7e6c98b5
BUG-1120: introduce generations to ListenerMap

This removes the synchronized block in the fast path, biasing the
implementation heavily towards fast readers.

The readers need only to take a volatile reference (AtomicReference),
at which point they have an isolated read-only view of the map.

Writers on the other hand, though, are fully synchronized and are
required to perform a full copy operation, then do the modifications and
finally reinstate the read-only view through setting the atomic
reference.

Change-Id: I5d118177c1508199b66b9e26499c9fc628d3f65e
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/GenerationalListenerMap.java
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/sal/binding/impl/ListenerMapGeneration.java [new file with mode: 0644]