use of org.apache.karaf.diagnostic.core.providers.HeapDumpProvider in project karaf by apache.
the class Dump method dump.
public static void dump(BundleContext bundleContext, DumpDestination destination, boolean noThreadDump, boolean noHeapDump) {
List<DumpProvider> providers = new ArrayList<>();
providers.add(new EnvironmentDumpProvider(bundleContext));
providers.add(new MemoryDumpProvider());
if (!noThreadDump)
providers.add(new ThreadDumpProvider());
if (!noHeapDump)
providers.add(new HeapDumpProvider());
providers.add(new BundleDumpProvider(bundleContext));
for (DumpProvider provider : providers) {
try {
provider.createDump(destination);
} catch (Throwable t) {
// Ignore
}
}
try {
for (ServiceReference<DumpProvider> ref : bundleContext.getServiceReferences(DumpProvider.class, null)) {
DumpProvider provider = bundleContext.getService(ref);
try {
provider.createDump(destination);
} catch (Throwable t) {
// Ignore
} finally {
bundleContext.ungetService(ref);
}
}
} catch (InvalidSyntaxException e) {
// Ignore
}
try {
destination.save();
} catch (Throwable t) {
// Ignore
}
}
Aggregations