How to call a code only once

2013-06-27 Thread CLEMENT Jean-Philippe
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

Re: How to call a code only once

2013-06-27 Thread Jean-Baptiste Onofré
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

Re: How to call a code only once

2013-06-27 Thread Łukasz Dywicki
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

Re: How to call a code only once

2013-06-27 Thread Jean-Baptiste Onofré
Not sure I follow you: When a class loaded by a bundle's class loader attempts to load a native library, by calling System.loadLibrary, the findLibrary method of the bundle’s class loader must be called to return the file path in which the Framework has made the requested native library

Re: How to call a code only once

2013-06-27 Thread Łukasz Dywicki
Jean, Native libraries are linked with system classloader thus they are not re-loaded even if bundle is updated. Cheers, Lukasz Wiadomość napisana przez Jean-Baptiste Onofré j...@nanthrax.net w dniu 27 cze 2013, o godz. 20:56: Not sure I follow you: When a class loaded by a bundle's

Re: How to call a code only once

2013-06-27 Thread Achim Nierbeck
Lukasz, this is wrong. Nativ Libraries are reloaded in case a bundle is updated. Though you need to take care of certain restrictions. Native Libraries inside a bundle must not be linked to other native libraries that are inside this or another bundle and may only depent to system libraries. This

Re: How to call a code only once

2013-06-27 Thread Łukasz Dywicki
Yes, you are right. I've back to the spec and the case I described is true for libraries which are loaded by system classloader, ie from $KARAF_HOME/lib or other places which are not found by bundle classloaders. However, you can't be sure when native library will be unloaded by JVM since it's

Re: dev:restart and permanent generation leak?

2013-06-27 Thread Raman Gupta
JB, did you have a chance to take a look at this? Do you want me to create an entry in Jira? Regards, Raman On 01/31/2013 03:05 AM, Jean-Baptiste Onofré wrote: Hi Raman, I tried with Felix, same behavior. Each dev:restart execution uses around 80% of additional Perm Gen: - 23,724,976 -