Could not add FrameworkListener from ServiceListener
----------------------------------------------------
Key: FELIX-3096
URL: https://issues.apache.org/jira/browse/FELIX-3096
Project: Felix
Issue Type: Bug
Affects Versions: framework-3.2.2
Reporter: Vlad Arkhipov
Priority: Critical
It's now impossible to add a FrameworkListener from ServiceListener in 3.2.x,
worked in 3.0.9. The code below hangs in addFrameworkListener when it tries to
acquire a global lock on the framework bundle.
Framework framework = ...
framework.init();
final BundleContext ctx = framework.getBundleContext();
ctx.addServiceListener(new ServiceListener() {
public void serviceChanged(ServiceEvent event) {
if (...) {
ctx.addFrameworkListener(new FrameworkListener() {
public void frameworkEvent(FrameworkEvent event) {
System.out.println(event);
}
});
}
}
});
StartLevel sl = (StartLevel)
ctx.getService(ctx.getServiceReference(StartLevel.class.getName()));
// Install bundles, set start level.
...
framework.start();
framework.waitForStop();
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira