[ 
https://issues.apache.org/jira/browse/FELIX-314?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Felix Meschberger updated FELIX-314:
------------------------------------

    Attachment: FELIX-314.diff

Patch trying to fix the EventDispatcher issue.

This patch turns all static fields and methods into instance fields and 
methods. As a consequence the EventDispatcher constructor will start a thread 
on each call, while the EventDispatcher.shutdown method will stop the thread 
and remove the local reference to it.

Incidentally, only two locations inside the Framework project are touched by 
this change: The Felix.shutdownInternalStart and Felix.start methods have to 
use the m_dispatcher field instead of calling the static method.

I do not know of any other users of the EventDispatcher class, but I assume, 
there aren't any outside the Framework.

If nobody opposes, I will apply this patch.

> EventDispatcher class not reusable in same class loader for multiple Felix 
> instances
> ------------------------------------------------------------------------------------
>
>                 Key: FELIX-314
>                 URL: https://issues.apache.org/jira/browse/FELIX-314
>             Project: Felix
>          Issue Type: Bug
>          Components: Framework
>    Affects Versions: 0.8.0
>            Reporter: Felix Meschberger
>             Fix For: 1.0.0
>
>         Attachments: FELIX-314.diff
>
>
> Consider this use case:
>    Felix felix = new Felix();
>    felix.start(props, null);
>    felix.shutdown();
>    felix = new Felix();
>    felix.start(props, null);
>    felix.shutdown();
> The first Felix instance will stop the EventDispatcher by calling the static 
> EventDispatcher.shutdown() method thus stopping the event dispatcher thread 
> and setting the static variables stopping and stopped to true. The reference 
> to the event dispatcher thread in the static variable m_thread is not cleared 
> on shutdown.
> The second Felix instance will create an EventDispatcher instance but the 
> static fields are not reset. That is the event dispatcher is assumed to be 
> stopped and the event dispatcher thread will not be newly created and started.
> I will suggest a patch for this issue.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to