Lazily create schema context in GlobalBundleScanning* 00/56200/2
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 27 Apr 2017 16:38:37 +0000 (18:38 +0200)
committerRobert Varga <nite@hq.sk>
Thu, 27 Apr 2017 22:05:17 +0000 (22:05 +0000)
commit5b03ecd0db7452a656d250ef11e76a509e4a3cc3
tree1d9c9905ac626a65c682706dea44421d4a90a72b
parentceb3877d2e6fd837a63c730f06b6f97d2c624d12
Lazily create schema context in GlobalBundleScanning*

On OsgiBundleScanningSchemaService startup, it calls
tryToUpdateSchemaContext when bundleTracker.open() completes.
This parses and creates a schema context and notifies listeners
of the updated schema context. However we don't have to call
tryToUpdateSchemaContext in start() unless there actually are
listeners registered as the purpose of tryToUpdateSchemaContext
is to update listeners. So made this change. It's not likely there
would be any listeners at that point anway.

I also changed the synchronization so as not to synchronize on 'this'
or the class instance as both are unsafe (users could sync on the
instance causing unwanted contention, either innocently or maliciously).

Change-Id: I435358b0851671b7fbfdc9784577c91ff20556df
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 62ca5284757904ee8a2ac0f79f07b0f4c41dc830)
dom/mdsal-dom-broker/src/main/java/org/opendaylight/mdsal/dom/broker/osgi/OsgiBundleScanningSchemaService.java
dom/mdsal-dom-broker/src/test/java/org/opendaylight/mdsal/dom/broker/osgi/OsgiBundleScanningSchemaServiceTest.java