OSGi : Change bundles cache algorithm

37 Views Asked by At

I am trying to figure out how to change OSGI bundles cache algorithm.

I have a local repository which holds all the jars on NFS drive. When I am launching my application, OSGI bundles cache algorithm copies all the Jars to a cache folder, which ends up in ~500MB per application session. Since all these Jars are available and accessible locally, there is no need to cache them once again in OSGI cache folder. I would like to change the algorithm to either:

  1. create a soft link instead of actually copying the Jar file
  2. disable the cache mechanism completely so the files will be read from their original location

Any idea how can I achieve that?

Thanks!!

I tried to pass the following property: props.put(Constants.FRAMEWORK_STORAGE_CLEAN, Constants.FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT); To: BundleContext::registerService But it did not solve the issue.

1

There are 1 best solutions below

0
Montassar Bouajina On

The problem is that Java lock mechanism does not works properly on such file system (NFS) try to specify as a jvm argument (-vmargs) -Dosgi.locking=java.io or -Dosgi.locking=none