directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guillaume Nodet <gno...@gmail.com>
Subject Re: OSGi startup and shutdown problems
Date Wed, 11 May 2011 14:16:41 GMT
Indeed, that's a nice trick.
If I understand the code correctly, you need to make sure the
exception is reported back to the current thread, else you the user
won't even notice any problem (well, in the log of course but no
exception).

On Wed, May 11, 2011 at 15:56, Emmanuel Lécharny <elecharny@apache.org> wrote:
> On 5/11/11 3:42 PM, Alex Karasulu wrote:
>>>
>>> Usually, we are just hiding it if the user does not have its own OSGi
>>> container.
>>>
>>>
>> Please clarify.
>
> The user does not know we embed and start Felix. For him, it's 'hidden'.
>
> Btw, the pb I was trying to solve (ie, the Felix EventDispatchQueue thread
> was still running even if we quit the application) has a nice workaround.
> The pb was that the felix thread was a User thread, not a Daemon thread,
> thus needed to be stopped explicitly. What would have been good is to be
> able to make this thread a Daemon thread, but as it's created internally of
> Felix, there was no way to do that.
>
> Hopefully, Karl and Richard mentionned that if you start a thread from a
> daemon thread, then the inner thread will inheritate it's parent status. So
> I started felix inside a Daemon thread, and it did the trick :
>
>        Thread felixThread = new Thread(new Runnable() {
>            public void run()
>            {
>                try
>                {
>                    felix.start();
>                }
>                catch ( BundleException e )
>                {
>                    String message = "Failed to start embedded felix
> instance: " + e.getMessage();
>                    LOG.error( message, e );
>                    throw new RuntimeException( message, e );
>                }
>            }
>        }, "FelixThread");
>
>        felixThread.setDaemon( true );
>        felixThread.start();
>
> instead of :
>
> felix.start();
>
>
> --
> Regards,
> Cordialement,
> Emmanuel Lécharny
> www.iktek.com
>
>



-- 
Cheers,
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com

Connect at CamelOne May 24-26
The Open Source Integration Conference
http://camelone.com/

Mime
View raw message