Make ListenersBroker.getInstance() lockless 43/96843/4
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 8 Jul 2021 18:55:25 +0000 (20:55 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 8 Jul 2021 20:25:56 +0000 (22:25 +0200)
commit27c8ce3272443809c6607e8c5da347c41970f6f1
treeb0d25d4e4e97ce441d80d8bd340f8443071b3cb4
parentaf9355cc26d14fcb1d5c725496d440bfced8c10b
Make ListenersBroker.getInstance() lockless

While this is a huge antipattern in terms of retained global state,
we do not need to bounce a global lock to access it.

Use Initialization-on-demand holder idiom to make the access completely
lockless.

Change-Id: I374737f2dc5b3b07226eb7bbffcaaf2665cc8967
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/streams/listeners/ListenersBroker.java