I have a Java application that runs in OSGi/Equinox. From this application, I need to spawn Java subprocesses (e.g. via ProcessBuilder.start()
) that run in OSGi/Equinox as well in order to handle class loading correctly. The subprocess will require multiple bundles, so I would ideally like some fairly dynamic way of installing those bundles in the subprocess' Equinox container, such as by reading feature.xml files.
I have read through program launching here but I don't see how Equinox can fit into it. I also looked into doing something like this, but it wouldn't be very dynamic, especially when the entry-point bundle of the subprocess requires multiple other bundles, which require further bundles, etc.
So, how can I spawn a subprocess to run in OSGi/Equinox with a fairly dynamic way of loading bundles into the container?
Note: I need to use separate processes. The subprocesses will do data processing using a JNA native library that uses global variables (and I can't modify the native library). So, in order to be able to process different data concurrently, the data processing needs to run in separate processes.