Lazily create schema context in GlobalBundleScanning* 87/56187/2
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 27 Apr 2017 16:38:37 +0000 (18:38 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 27 Apr 2017 18:31:21 +0000 (20:31 +0200)
commit62ca5284757904ee8a2ac0f79f07b0f4c41dc830
treeeb17c4c90e3c7b20345afd9e2e8fa2c38e863ac7
parentb0a11d8bb72e2b74f64ca1dbd6d981cf3a70c8ea
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>
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