Hi Richard,
Thanks alot.
Regards
Felix, the person :-)
On 6/20/06, Richard S. Hall <[EMAIL PROTECTED]> wrote:
Yes, you are correct, the current approach is not aggressive enough
since it relies on GC, which is probably not the best idea. I will add
your patch below to the shutdown method and commit shortly.
-> richard
Felix Meschberger wrote:
> Hi again,
>
> During my tests of replacing plain file system access with a
> factory-based resource wrapper, I noticed, that on shutdown of the
> framework, the modules are not properly closed. Thus the jar files
> remain open until either garbage collected or the vm exits.
>
> Shouldn't the Felix.shutdown() method close those modules doing
> something like:
>
> bundles = getBundles();
> for (int i = 0; i < bundles.length; i++) {
> BundleImpl bundle = (BundleImpl) bundles[i];
> try {
> IModule[] modules = bundle.getInfo().getModules();
> for (int j = 0; j < modules.length; j++) {
> m_factory.removeModule(modules[j]);
> }
> }
> catch (Exception ex) {
> m_logger.log(Logger.LOG_ERROR,
> "Unable to remove " +
> bundle.getInfo().getLocation(), ex);
> }
> }
>
> For my special use case - I create temporary files for the jar files
> when running with a non-file system repository - this would enable the
> JarFileX.close() method to remove the temporary files.
>
> Regards
> Felix
>