You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by Felix Meschberger <fm...@gmail.com> on 2006/06/20 10:10:42 UTC
Shutting down the framework
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
Re: Shutting down the framework
Posted by Felix Meschberger <Fe...@day.com>.
Thanks. It works for me.
Regards
Felix
On 6/20/06, Richard S. Hall <he...@ungoverned.org> wrote:
> Done. Let me know if it is working fine for you.
>
> -> richard
>
> Felix Meschberger wrote:
> > Hi Richard,
> >
> > Thanks alot.
> >
> > Regards
> > Felix, the person :-)
> >
> > On 6/20/06, Richard S. Hall <he...@ungoverned.org> 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
> >> >
> >>
> >
>
Re: Shutting down the framework
Posted by "Richard S. Hall" <he...@ungoverned.org>.
Done. Let me know if it is working fine for you.
-> richard
Felix Meschberger wrote:
> Hi Richard,
>
> Thanks alot.
>
> Regards
> Felix, the person :-)
>
> On 6/20/06, Richard S. Hall <he...@ungoverned.org> 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
>> >
>>
>
Re: Shutting down the framework
Posted by Felix Meschberger <Fe...@day.com>.
Hi Richard,
Thanks alot.
Regards
Felix, the person :-)
On 6/20/06, Richard S. Hall <he...@ungoverned.org> 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
> >
>
Re: Shutting down the framework
Posted by "Richard S. Hall" <he...@ungoverned.org>.
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
>