aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Ross2013-12-03 11:22:44 (EST)
committerJohn Ross2013-12-05 16:10:52 (EST)
commit111ae43b1f4daef99e59541c982eeac256c49ca8 (patch)
treed8b676340df7c517e3575f4b8fe9194ef193e3b1
parente63ebd96d5eecb32c44ef6d2d315e04074cf771c (diff)
downloadrt.equinox.framework-111ae43b1f4daef99e59541c982eeac256c49ca8.zip
rt.equinox.framework-111ae43b1f4daef99e59541c982eeac256c49ca8.tar.gz
rt.equinox.framework-111ae43b1f4daef99e59541c982eeac256c49ca8.tar.bz2
[Bug 420067] Add support for org.eclipse.osgi/resolver/hooks resolver trace option.
Setting org.eclipse.osgi/resolver/hooks = true will print out everything filtered by resolver hooks. Information is printed out separately for each method: filterMatches, filterResolvable, and filterSingletonCollisions. The filterMatches information is now printed for both DEBUG_PROVIDERS and DEBUG_HOOKS.
-rw-r--r--bundles/org.eclipse.osgi/.options5
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleResolver.java44
2 files changed, 45 insertions, 4 deletions
diff --git a/bundles/org.eclipse.osgi/.options b/bundles/org.eclipse.osgi/.options
index 6e8fded..7a962b4 100644
--- a/bundles/org.eclipse.osgi/.options
+++ b/bundles/org.eclipse.osgi/.options
@@ -43,7 +43,10 @@ org.eclipse.osgi/eclipseadaptor/converter/debug = false
org.eclipse.osgi/resolver = false
# Displays information about matching capabilities returned to the resolver and
# why any were filtered out.
-org.eclipse.osgi/resolver/providers = true
+org.eclipse.osgi/resolver/providers = false
+# Displays information about capabilities or resources that were filtered by
+# resolver hooks.
+org.eclipse.osgi/resolver/hooks = false
#### Profile settings
org.eclipse.osgi/profile/startup = false
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleResolver.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleResolver.java
index 09456b0..5d173de 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleResolver.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/container/ModuleResolver.java
@@ -41,9 +41,11 @@ final class ModuleResolver {
private static final String OPTION_RESOLVER = EquinoxContainer.NAME + "/resolver"; //$NON-NLS-1$
private static final String OPTION_PROVIDERS = OPTION_RESOLVER + "/providers"; //$NON-NLS-1$
+ private static final String OPTION_HOOKS = OPTION_RESOLVER + "/hooks"; //$NON-NLS-1$
static boolean DEBUG_RESOLVER = false;
static boolean DEBUG_PROVIDERS = false;
+ static boolean DEBUG_HOOKS = false;
private void setDebugOptions() {
DebugOptions options = adaptor.getDebugOptions();
@@ -52,6 +54,7 @@ final class ModuleResolver {
return;
DEBUG_RESOLVER = options.getBooleanOption(OPTION_RESOLVER, false);
DEBUG_PROVIDERS = options.getBooleanOption(OPTION_PROVIDERS, false);
+ DEBUG_HOOKS = options.getBooleanOption(OPTION_HOOKS, false);
}
private static final Collection<String> NON_PAYLOAD_CAPABILITIES = Arrays.asList(IdentityNamespace.IDENTITY_NAMESPACE);
@@ -570,11 +573,11 @@ final class ModuleResolver {
filterPermissions((BundleRequirement) requirement, iCandidates);
List<ModuleCapability> filteredMatches = null;
- if (DEBUG_RESOLVER || DEBUG_PROVIDERS) {
+ if (DEBUG_RESOLVER || DEBUG_PROVIDERS || DEBUG_HOOKS) {
filteredMatches = new ArrayList<ModuleCapability>(candidates);
}
hook.filterMatches((BundleRequirement) requirement, InternalUtils.asListBundleCapability(candidates));
- if (DEBUG_RESOLVER || DEBUG_PROVIDERS) {
+ if (DEBUG_RESOLVER || DEBUG_PROVIDERS || DEBUG_HOOKS) {
filteredMatches.removeAll(candidates);
if (!filteredMatches.isEmpty()) {
StringBuilder builder = new StringBuilder("RESOLVER: Capabilities filtered by ResolverHook.filterMatches"); //$NON-NLS-1$
@@ -1073,8 +1076,12 @@ final class ModuleResolver {
Collection<ModuleRevision> enabledCandidates = new ArrayList<ModuleRevision>(unresolved);
hook.filterResolvable(InternalUtils.asListBundleRevision((List<? extends BundleRevision>) enabledCandidates));
disabled.removeAll(enabledCandidates);
- for (ModuleRevision revision : disabled)
+ for (ModuleRevision revision : disabled) {
reportBuilder.addEntry(revision, Entry.Type.FILTERED_BY_RESOLVER_HOOK, null);
+ if (DEBUG_RESOLVER || DEBUG_HOOKS) {
+ Debug.println("RESOLVER: Resource filtered by ResolverHook.filterResolvable: " + revision); //$NON-NLS-1$
+ }
+ }
}
private void selectSingletons() {
@@ -1203,6 +1210,37 @@ final class ModuleResolver {
for (BundleCapability identity : capabilities) {
collisionCandidates.add((ModuleRevision) identity.getRevision());
}
+ if (DEBUG_RESOLVER || DEBUG_HOOKS) {
+ Collection<ModuleRevision> filteredSingletons = new ArrayList<ModuleRevision>(sameBSN);
+ filteredSingletons.removeAll(collisionCandidates);
+ filteredSingletons.remove(singleton);
+ if (!filteredSingletons.isEmpty()) {
+ StringBuilder builder = new StringBuilder("RESOLVER: Resources filtered by ResolverHook.filterSingletonCollisions") //$NON-NLS-1$
+ .append(SEPARATOR).append(TAB) //
+ .append("Singleton") //$NON-NLS-1$
+ .append(SEPARATOR).append(TAB).append(TAB) //
+ .append(singleton) //
+ .append(" [id=") //$NON-NLS-1$
+ .append(singleton.getRevisions().getModule().getId()) //
+ .append(", location=") //$NON-NLS-1$
+ .append(singleton.getRevisions().getModule().getLocation()) //
+ .append(']') //
+ .append(SEPARATOR).append(TAB) //
+ .append("Collisions"); //$NON-NLS-1$
+ int i = 0;
+ for (ModuleRevision revision : filteredSingletons) {
+ builder.append(SEPARATOR).append(TAB).append(TAB) //
+ .append("[").append(++i).append("] ") //$NON-NLS-1$ //$NON-NLS-2$
+ .append(revision) //
+ .append(" [id=") //$NON-NLS-1$
+ .append(revision.getRevisions().getModule().getId()) //
+ .append(", location=") //$NON-NLS-1$
+ .append(revision.getRevisions().getModule().getLocation()) //
+ .append(']');
+ }
+ Debug.println(builder.toString());
+ }
+ }
result.put(singleton, collisionCandidates);
}
return result;