Dear all, As OSGi core spec says - native libraries are loaded once and they are linked with classloader. Due the fact that bundle classloader only find the native library for system classloader which performs load the DLL/SO file is always loaded only once and remains in memory untill JVM shutdown.
For details see OSGi 5 Core Spec section 3.10, especially paragraph 3.10.2. Czheers, Łukasz Dywicki -- [email protected] Twitter: ldywicki Blog: http://dywicki.pl Code-House - http://code-house.org Wiadomość napisana przez CLEMENT Jean-Philippe <[email protected]> w dniu 27 cze 2013, o godz. 17:04: > From what I understand BundleActivator warns when un bundle is > started/stopped, which is not exactly the usecase I would like. > > The .so lib must be loaded once. The best thing would be to obtain an event > stating the bundle is installed so I may load the lib. > > For the moment I added a class with a static part. I load the lib when that > class is loaded by the classloader, which is not very good but does the job. > I also put the bundle as singleton for extra protection. > > JP > > [@@ OPEN @@] > > -----Message d'origine----- > De : Jean-Baptiste Onofré [mailto:[email protected]] > Envoyé : jeudi 27 juin 2013 16:15 > À : [email protected] > Objet : Re: How to call a code only once > > Hi JP, > > you can control the loading in the BundleActivator. > > Regards > JB > > On 06/27/2013 10:45 AM, CLEMENT Jean-Philippe wrote: >> Dear Karaf, >> >> I have a bundle which loads .so libraries. I would like this code to run >> once. What is the easiest way to do so? >> >> Best regards, >> JP >> > > -- > Jean-Baptiste Onofré > [email protected] > http://blog.nanthrax.net > Talend - http://www.talend.com
