Package jep
Class SharedInterpreter
- java.lang.Object
-
- jep.Jep
-
- jep.SharedInterpreter
-
- 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
-
-
Constructor Summary
Constructors Constructor Description SharedInterpreter()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
setConfig(JepConfig config)
Sets interpreter settings for the all SharedInterpreters.-
Methods inherited from class jep.Jep
close, eval, exec, getValue, getValue, getValue_bytearray, invoke, invoke, invoke, isInteractive, isValidThread, runScript, runScript, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, set, setClassLoader, setInitParams, setInteractive, setSharedModulesArgv
-
-
-
-
Constructor Detail
-
SharedInterpreter
public SharedInterpreter() throws JepException
- Throws:
JepException
-
-
Method Detail
-
setConfig
public static void setConfig(JepConfig config) throws JepException
Sets interpreter settings for the all SharedInterpreters. This method must be called before the first SharedInterpreter is created in the process.- Parameters:
config
- the jep configuration to use.- Throws:
JepException
- if an error occurs- Since:
- 3.9
-
-