[ http://issues.apache.org/jira/browse/FELIX-169?page=all ]

Felix Meschberger updated FELIX-169:
------------------------------------

    Attachment: FELIX-169.diff

Attached is a patch, which also should fix a symetry issue: If the framework is 
shut down through the Framework.shutdown() method by the application, the 
SystemBundle.stop method does not start a separate thread, which at the end 
terminates the VM if not embedded.

The patch creates a new Felix.shutdownInternal() method, which is called by the 
SystemBundle.stop() method. The Felix.shutdown() method just calls the 
getBundle(0).stop() method, which then takes care to start the separate thread, 
call the Felix.shutdownInternal() method and finally terminating the VM if not 
embedded.

There is one catch, though: This patch causes the framework to shutdown 
asynchronously also for Felix.shutdown(). This may be desired in terms of 
symetry - however I stop the framework, it always does it the same way - or it 
may not besired, as Felix.shutdown() should possibly be a synchronous operation.

In the latter case, the Felix.shutdown() method should probably be extended to 
Thread.join() the shutdown thread.

What do you think ? If so, I could provide a patch for this, too.

> Shutdown of Felix through Felix.shutdown() does not call custom activator 
> stop methods
> --------------------------------------------------------------------------------------
>
>                 Key: FELIX-169
>                 URL: http://issues.apache.org/jira/browse/FELIX-169
>             Project: Felix
>          Issue Type: Bug
>            Reporter: Felix Meschberger
>         Attachments: FELIX-169.diff
>
>
> When starting Felix through Felix.start() a list of BundleActivator objects 
> may be handed in. Additionally, the SystemBundle adds some more 
> BundleActivators (e.g. the URLHandlersActivator. When stopping Felix through 
> the SystemBundle.stop() method, a separate thread is started, which calls the 
> Felix.shutdown() method, which ultimately calls back into the 
> SystemBundle.stop() method, which now - amongst other things - calls the 
> BundleActivator.stop() method of the additional BundleActivators.
> If shutting Felix down through Felix.shutdown() directly, a separate thread 
> is not started, and hence the BundleActivator.stop() methods are not called.
> I assume, the test for the m_shutdownThread field in the SystemBundle.stop 
> method is superfluous as this field is only set then Felix is stopped through 
> the system bundle.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to