- All Implemented Interfaces:
- java.lang.AutoCloseable, Interpreter
public class SharedInterpreter
extends Jep
Class for creating instances of Interpreters which share all imported
modules. In this case each SharedInterpreter still maintains distinct global
variables but some interpreter state will be shared. This is equivalent to
using shared modules to share every Python package in Jep. Anything that
changes the way a module behaves will impact all SharedInterpreters so care
must be taken to ensure that different SharedInterpreters aren't conflicting.
For example sys.path, time.tzset(), and numpy.seterr() will change the
behavior of all SharedInterpreters.
Within a single Java process it is valid to mix Interpreter instances that
use SubInterpreters with SharedInterpreters. The SubInterpreter instances
will remain isolated from SubInterpreter instances and from any
SharedInterpreters. To maintain stability, it is not possible to have
multiple Interpreter instances active on the same Thread at the same time and
this limitation includes SharedInterpreters.
- Since:
- 3.8