Remove YangModuleInfo when it is unregistered 71/83071/12
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 23 Jul 2019 13:47:22 +0000 (15:47 +0200)
committerRobert Varga <nite@hq.sk>
Mon, 29 Jul 2019 08:10:41 +0000 (08:10 +0000)
commit6072e689bdef8c166b4633ec5dedc6e7e636b8d5
treefc52731b092fcc46a850a2c79141b54f92892682
parent5edefb12d742c8d6bbd66797898bf940c73afe3c
Remove YangModuleInfo when it is unregistered

This patch addresses a FIXME, which was left in the code base
and thus makes sure we do not retain stale class loaders from
explicit registrations.

Unfortunately the design of this class mixes quite a few aspects:
- the ability to build SchemaContext
- the ability to explicitly register YangModuleInfos (with their
  dependencies)
- the ability to implicitly register YangModuleInfos through
  ClassLoadingStrategy.loadClass() failure path
- the ability to create an instance with pre-populated set of entries
  used only for testing/static purposes

The interplay between these aspects is ill-defined, especially
items 2 and 3, hence fixing the issue in most correct way possible
requires redesigning internal state tracking, explicitly
differentiating between the two cases.

JIRA: MDSAL-461
Change-Id: I8f99d3975e971e32b267788a463d9b73bb57e49e
Signed-off-by: Jie Han <han.jie@zte.com.cn>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/mdsal/binding/generator/impl/ModuleInfoBackedContext.java