protected void uninstallUnusedOnDemandContexts(ControllerContext context, boolean trace)
{
lockWrite();
try
{
DependencyInfo dependencies = context.getDependencyInfo();
if (dependencies != null)
{
Set<DependencyItem> iDependOn = dependencies.getIDependOn(null);
if (iDependOn.isEmpty() == false)
{
for (DependencyItem item : iDependOn)
{
if (item.isResolved()) //TODO Is this check necessary
{
Object name = item.getIDependOn();
if (name == null)
continue;
ControllerContext other = getContext(name, null);
if (other == null)
{
log.warn("Could not find dependency while uninstalling on demand contexts for " + item);
continue;
}
if (other.getMode() != ControllerMode.ON_DEMAND)
continue;
DependencyInfo otherDependencies = other.getDependencyInfo();
if (otherDependencies == null)
continue;
Set<DependencyItem> dependsOnOther = otherDependencies.getDependsOnMe(null);
boolean isRequired = false;
for (DependencyItem dependsOnOtherItem : dependsOnOther)
{
ControllerContext dependsContext = getContext(dependsOnOtherItem.getName(), null);
if (dependsContext == null)