in src/main/java/org/apache/sling/extensions/leakdetector/internal/LeakDetector.java [175:220]
public void printConfiguration(PrintWriter pw) {
//Try to force GC
//TODO Should we do by default or let user do it explicitly via
//Felix Web Console
//System.gc();
Set<Long> activeBundleIds = new HashSet<Long>();
for (Bundle b : context.getBundles()) {
activeBundleIds.add(b.getBundleId());
}
List<BundleInfo> suspiciousBundles = new ArrayList<BundleInfo>(bundleInfos.values());
Iterator<BundleInfo> itr = suspiciousBundles.iterator();
while (itr.hasNext()) {
BundleInfo bi = itr.next();
//Filter out bundles which are active and have
//only one classloader created for them
if (bi.hasSingleInstance()
&& activeBundleIds.contains(bi.bundleId)) {
itr.remove();
}
}
if (suspiciousBundles.isEmpty()) {
pw.println("No classloader leak detected");
} else {
pw.println("Possible classloader leak detected");
pw.printf("Number of suspicious bundles - %d %n", suspiciousBundles.size());
pw.println();
final String tab = " ";
for(BundleInfo bi : suspiciousBundles){
pw.printf("* %s %n", bi);
pw.printf("%s - Bundle Id - %d %n", tab, bi.bundleId);
pw.printf("%s - Leaked classloaders %n", tab);
for(ClassloaderInfo ci : bi.leakedClassloaders()){
pw.printf("%s%s - %s %n", tab, tab, ci);
}
}
}
pw.println();
addHelp(pw);
}