I'm trying to figure out what the org.osgi.framework.storage.clean=onFirstInit
really means in the context of the Felix framework.
According to the OSGi specification:
org.osgi.framework.storage: A valid file path in the file system to a directory... The framework is free to use this directory as it sees fit, for example, completely erase all files and directories in it...
org.osgi.framework.storage.clean: Specifies if and when the storage area for the framework should be cleaned. If no value is specified, the framework storage area will not be cleaned.
Since according to the specification the framework is free to use this directory as it sees fit, it is unclear what is meant when the OSGi specification states that the storage area should be cleaned. Cleaning could mean something different for each OSGi implementation.
The Apache Felix documentation states:
onFirstInit flushes the bundle cache when the framework instance is first initialized.
Specific to the Felix documentation:
rm -rf felix-cache
while the Felix container is shut down so that when it starts up it rebuilds the cache as if this was the first time the container was started?What does it mean to "flush the bundle cache"?
It means deleting the directory specified by org.osgi.framework.storage
Is flushing the same as deleting the storage directory and then rebuilding it from scratch?
Yes
So it would be the same as rm -rf felix-cache while the Felix container is shut down so that when it starts up it rebuilds the cache as if this was the first time the container was started?
Yes
What does it mean when it says "when the framework instance is first initialized"?
Bundles can be initialized multiple times. This statement indicates that the directory should only be deleted the first time after the JVM starts not subsequent times the system bundle is initialized.
Does this mean the first time the framework is initialized only on the first time the container is started? Or does it mean the first time the framework is initialized every time the container is restarted?
It means the first time the framework is initialized every time the container is restarted
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With