Lazily create schema context in GlobalBundleScanning* 05/56205/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:11 +0000 (22:05 +0000)
commit98bc46847cda68e350c3d498e2bd718f7f82cafa
treee0926146c10a2e3f09e759bcb6e2e159605ed490
parentc2c61de266b41416a11f381d3dba79d5866d7e76
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