Package jep

Class SubInterpreter

java.lang.Object
jep.Jep
jep.SubInterpreter
All Implemented Interfaces:
AutoCloseable, Interpreter

public class SubInterpreter extends Jep
Class for creating instances of Interpreters which are sandboxed from other Interpreters. Sub-interpreters isolate different SubInterpreter instances, allowing them to be used safely from multiple unrelated pieces of a Java application without any risk that the SubInterpreters will impact each other. An exception to this is when a SubIntepreter uses CPython extensions, there is no guarantee that other Interpreters may not be affected. The level of isolation depends on if the CPython extension was written to support multiple interpreters in the same process. In those cases you may want to consider using the shared modules feature or a SharedInterpreter. Within a single Java process it is valid to mix Interpreter instances that use SubInterpreters with SharedInterpreters. The SubInterpreter instances will remain isolated from other SubInterpreters 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 SubInterpreters.
Since:
3.9