BUG-1120: introduce generations to ListenerMap
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)
commitc08744f995ced579456d6c586a620fcd326c7bf9
tree78ba79a578c0df3f62dc24248f74062ca56a26d4
parent6e9bde394b8cba01b1c73139faa775df157ade7f
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]