You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by Tim Moloney <t....@verizon.net> on 2008/03/21 18:31:44 UTC
Disable bundle cache?
I hope this isn't a silly question but...
Is it possible to disable the bundle cache? In other words, make Felix
always get the bundle from the jar file, not from the cache?
I've found the configuration parameters that allow me to change the
profile directory, and the default profile, but nothing that would turn
off the cache.
Thanks,
Tim
Re: Disable bundle cache?
Posted by "Richard S. Hall" <he...@ungoverned.org>.
Tim Moloney wrote:
> Richard S. Hall wrote:
>> Short answer, no. At least not in the sense of truly "disabling the
>> bundle cache", because the mere fact that you want Felix to remember
>> that there are bundles in the cache to re-get means that it must be
>> saving something.
>
> I may be missing something fundamental in how Felix works, but the
> point is that I *don't* want Felix to remember that there are bundles
> in the cache. During development, I don't want a cache at all. I
> can't tell you the number of times I've forgotten to delete the cache
> so I wasn't running the code I thought I was.
Well, the way Felix works, it uses the cache always, which is what the
spec says it should do. However, that doesn't mean that we couldn't
provide such a feature, but you could handle this case very well just by
creating your own launcher that deletes the cache directory after execution.
We also have an issue that is related to this:
https://issues.apache.org/jira/browse/FELIX-465
The question on there is whether people just want the cache deleted
between executions or whether the desire is to eliminate disk usage at
all. The latter is harder, but not impossible...it would just require
creating a cache implementation that holds everything in memory (thus
trading RAM space for disk space).
At any rate, if people simply want the launcher to delete the profile
directory between executions, then this is simple...so if there is
enough support for such a feature (i.e., people should make some noise
on the above JIRA issue), then we could probably add a property to the
default launcher to do just that. Otherwise, creating a custom launcher
is not so difficult...the default launcher is intended to be simple and
NOT intended to do everything for everyone.
>> However, you can install a JAR file into the cache by reference using
>> a URL like "reference:file:/path/to/jar", but this approach is not
>> perfect if you have embedded JAR files and/or native code.
>
>
> Can you tell me more about this? Where do I put this URL?
When you install your bundle, instead of using "install
file:/path/to/jar" use "install reference:file:/path/to/jar".
As Marcel said, this isn't a good long-term approach, but it can
sometimes be sufficient.
-> richard
>
> Thanks,
> Tim
>
>>
>> -> richard
>>
>> Tim Moloney wrote:
>>> I hope this isn't a silly question but...
>>>
>>> Is it possible to disable the bundle cache? In other words, make
>>> Felix always get the bundle from the jar file, not from the cache?
>>>
>>> I've found the configuration parameters that allow me to change the
>>> profile directory, and the default profile, but nothing that would
>>> turn off the cache.
>>>
>>> Thanks,
>>> Tim
>>>
>>
>
Re: Disable bundle cache?
Posted by Marcel Offermans <ma...@luminis.nl>.
On Mar 23, 2008, at 5:06 , Tim Moloney wrote:
> Richard S. Hall wrote:
>> Short answer, no. At least not in the sense of truly "disabling the
>> bundle cache", because the mere fact that you want Felix to
>> remember that there are bundles in the cache to re-get means that
>> it must be saving something.
>
> I may be missing something fundamental in how Felix works, but the
> point is that I *don't* want Felix to remember that there are
> bundles in the cache. During development, I don't want a cache at
> all. I can't tell you the number of times I've forgotten to delete
> the cache so I wasn't running the code I thought I was.
Persistency of bundles and their state is mandated by the OSGi
specification, so it's behaviour you will see in all frameworks.
For development, you can do a couple of things:
a) Don't even stop your framework, but simply use the shell or a
simple "management agent" bundle, such as the recently donated
FileInstall bundle, to update changed bundles. This model stays much
closer to the final deployment scenario and will occasionally catch
other issues in your code that you would never find when always
starting without a cache.
b) Simply delete your cache as part of your Felix startup script. For
development, I usually define a cache that is in a direct subdirectory
of where I install my framework and bundles, so simply deleting that
directory before startup works fine.
c) Use the option Richard recommended, although I would advise a lot
of caution here, because installing by reference and updating that
reference directly circumvents the OSGi life cycle model and might
lead to all kinds of side effects. I really would recommend using that
option only if you absolutely need the (slight) speedup it gives, not
for serious development or testing.
Greetings, Marcel
Re: Disable bundle cache?
Posted by Tim Moloney <t....@verizon.net>.
Richard S. Hall wrote:
> Short answer, no. At least not in the sense of truly "disabling the
> bundle cache", because the mere fact that you want Felix to remember
> that there are bundles in the cache to re-get means that it must be
> saving something.
I may be missing something fundamental in how Felix works, but the point
is that I *don't* want Felix to remember that there are bundles in the
cache. During development, I don't want a cache at all. I can't tell
you the number of times I've forgotten to delete the cache so I wasn't
running the code I thought I was.
>
> However, you can install a JAR file into the cache by reference using
> a URL like "reference:file:/path/to/jar", but this approach is not
> perfect if you have embedded JAR files and/or native code.
Can you tell me more about this? Where do I put this URL?
Thanks,
Tim
>
> -> richard
>
> Tim Moloney wrote:
>> I hope this isn't a silly question but...
>>
>> Is it possible to disable the bundle cache? In other words, make
>> Felix always get the bundle from the jar file, not from the cache?
>>
>> I've found the configuration parameters that allow me to change the
>> profile directory, and the default profile, but nothing that would
>> turn off the cache.
>>
>> Thanks,
>> Tim
>>
>
Re: Disable bundle cache?
Posted by "Richard S. Hall" <he...@ungoverned.org>.
Short answer, no. At least not in the sense of truly "disabling the
bundle cache", because the mere fact that you want Felix to remember
that there are bundles in the cache to re-get means that it must be
saving something.
However, you can install a JAR file into the cache by reference using a
URL like "reference:file:/path/to/jar", but this approach is not perfect
if you have embedded JAR files and/or native code.
-> richard
Tim Moloney wrote:
> I hope this isn't a silly question but...
>
> Is it possible to disable the bundle cache? In other words, make
> Felix always get the bundle from the jar file, not from the cache?
>
> I've found the configuration parameters that allow me to change the
> profile directory, and the default profile, but nothing that would
> turn off the cache.
>
> Thanks,
> Tim
>