diff options
Diffstat (limited to 'bundles')
-rw-r--r-- | bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleDatabase.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleDatabase.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleDatabase.java index 988b79a43..737f83e59 100644 --- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleDatabase.java +++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleDatabase.java @@ -439,11 +439,37 @@ public class ModuleDatabase { } } if (allPendingRemoval) { + Map<ModuleWiring, Collection<ModuleWire>> toRemoveWireLists = new HashMap<ModuleWiring, Collection<ModuleWire>>(); + for (ModuleRevision pendingRemoval : dependencyClosure) { + ModuleWiring removedWiring = wirings.get(pendingRemoval); + if (removedWiring == null) { + continue; + } + List<ModuleWire> removedWires = removedWiring.getRequiredModuleWires(null); + for (ModuleWire wire : removedWires) { + Collection<ModuleWire> providerWires = toRemoveWireLists.get(wire.getProviderWiring()); + if (providerWires == null) { + providerWires = new ArrayList<ModuleWire>(); + toRemoveWireLists.put(wire.getProviderWiring(), providerWires); + } + providerWires.add(wire); + } + } for (ModuleRevision pendingRemoval : dependencyClosure) { pendingRemoval.getRevisions().removeRevision(pendingRemoval); removeCapabilities(pendingRemoval); wirings.remove(pendingRemoval); } + // remove any wires from unresolved wirings that got removed + for (Map.Entry<ModuleWiring, Collection<ModuleWire>> entry : toRemoveWireLists.entrySet()) { + List<ModuleWire> provided = entry.getKey().getProvidedModuleWires(null); + provided.removeAll(entry.getValue()); + entry.getKey().setProvidedWires(provided); + for (ModuleWire removedWire : entry.getValue()) { + // invalidate the wire + removedWire.invalidate(); + } + } } } } |