I need to call a python function from java, pass it an array, and get an array back. I realise I can do this with Jython.
The problem is, my python script needs to load a very heavy (and slow to load) model in order to run the function. So I was wondering if I could leave the python script on somehow, and let it listen to the next function call. Any ideas on this? I could have the java i/o files and communicate like this, but this seems like a (smaller though) bottleneck as well.
I read something about multiprocessing in python, but I am not sure this is the way to go https://docs.python.org/3/library/multiprocessing.html#multiprocessing-managers
I was able to keep the python script running by setting up a python socks server and a java client to communicate.