SPARQL-Anything/PySPARQL-Anything

JVM Configuration

MarcoR1791 opened this issue · 2 comments

The current version does not allow the user to have any control over the JVM and its parameters (e.g. max heap space).

I believe this is mostly due to how pyjnius works, as the JVM is launched at the import statement.
Thus, when pysparql_anything is imported the JVM is launched when __init__.py runs and imports the namespaces.

I believe we need:

  1. Decouple the JVM configuration and launch from the initialisation process and its current location in engine.py.
  2. Create either a specific jvm.py module or create specific function in config.py to make visible to clients (code and users)
    the required functionalities.

Thoughts @enridaga ?

Fixed in the above commit.

An important remark on this issue.

While the version 0.8.2.1 that is being worked on will allow configuring the JVM when constructing the initial SparqlAnything object, once a JVM has been launched it cannot be shut down and restarted unless one ends the process and starts a new one.
This limitation also applies to the case where the configuration parameters for the JVM are given with an error and therefore the JVM fails to launch.

This is unfortunately determined by the design of the JVM and JNI interaction and there is nothing at the moment that I can see being done to work around it.

For more information on this and similar issues please see for example:
[1] jpype-project/jpype#959,
[2] jpype-project/jpype#461.