[ 
https://issues.apache.org/jira/browse/FELIX-3096?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13102887#comment-13102887
 ] 

Richard S. Hall commented on FELIX-3096:
----------------------------------------

After more investigation, I think I've come to a way to resolve this. Due to 
some unrelated event dispatching refactoring for R4.3, we might be able to 
allow listeners to be added without holding the bundle lock. I still need to 
investigate it a little more, but so far so good.

> 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
>             Fix For: framework-4.0.0
>
>
> 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

        

Reply via email to