in src/main/java/org/apache/sling/commons/threaddump/internal/Activator.java [46:79]
public void start(BundleContext bundleContext) {
// install handler for uncaught exceptions
oldHandler = Thread.getDefaultUncaughtExceptionHandler();
Thread.setDefaultUncaughtExceptionHandler(this);
// install thread handler shell command
register(bundleContext,
new String[] { "org.apache.felix.shell.Command" },
new ServiceFactory() {
public void ungetService(final Bundle bundle,
final ServiceRegistration reg,
final Object consoleObject) {
// nothing to do
}
public Object getService(final Bundle bundle,
final ServiceRegistration reg) {
return new ThreadDumpCommand();
}
}, null);
// install Web Console configuration printer
final Dictionary<String, Object> props = new Hashtable<String, Object>();
props.put("felix.webconsole.label", "slingthreads");
props.put("felix.webconsole.title", "Threads");
props.put("felix.webconsole.configprinter.modes", "always");
final ThreadDumperPanel tdp = new ThreadDumperPanel();
register(bundleContext, new String[] {
tdp.getClass().getName() }, tdp, props);
}