- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
DirectExecutionControl
,JdiDefaultExecutionControl
,JdiExecutionControl
,LocalExecutionControl
,RemoteExecutionControl
,StreamingExecutionControl
public interface ExecutionControl extends AutoCloseable
This interface specifies the functionality that must provided to implement a
pluggable JShell execution engine.
The audience for this Service Provider Interface is engineers wishing to implement their own version of the execution engine in support of the JShell API.
A Snippet is compiled into code wrapped in a 'wrapper class'. The execution engine is used by the core JShell implementation to load and, for executable Snippets, execute the Snippet.
Methods defined in this interface should only be called by the core JShell implementation.
- Since:
- 9
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
ExecutionControl.ClassBytecodes
Bundles class name with class bytecodes.static class
ExecutionControl.ClassInstallException
A class install (load or redefine) encountered a problem.static class
ExecutionControl.EngineTerminationException
Unbidden execution engine termination has occurred.static class
ExecutionControl.ExecutionControlException
The abstract base of allExecutionControl
exceptions.static class
ExecutionControl.InternalException
An internal problem has occurred.static class
ExecutionControl.NotImplementedException
The command is not implemented.static class
ExecutionControl.ResolutionException
An exception indicating that aDeclarationSnippet
with unresolved references has been encountered.static class
ExecutionControl.RunException
The abstract base of of exceptions specific to running user code.static class
ExecutionControl.StoppedException
An exception indicating that aninvoke(java.lang.String, java.lang.String)
(or theoretically avarValue(java.lang.String, java.lang.String)
) has been interrupted by astop()
.static class
ExecutionControl.UserException
A 'normal' user exception occurred. -
Method Summary
Modifier and Type Method Description void
addToClasspath(String path)
Adds the path to the execution class path.void
close()
Shuts down this execution engine.Object
extensionCommand(String command, Object arg)
Run a non-standard command (or a standard command from a newer version).static ExecutionControl
generate(ExecutionEnv env, String spec)
Search for a provider, then create and return theExecutionControl
instance.static ExecutionControl
generate(ExecutionEnv env, String name, Map<String,String> parameters)
Search for a provider, then create and return theExecutionControl
instance.String
invoke(String className, String methodName)
Invokes an executable Snippet by calling a method on the specified wrapper class.void
load(ExecutionControl.ClassBytecodes[] cbcs)
Attempts to load new classes.void
redefine(ExecutionControl.ClassBytecodes[] cbcs)
Attempts to redefine previously loaded classes.void
stop()
Interrupts a running invoke.String
varValue(String className, String varName)
Returns the value of a variable.
-
Method Details
-
load
void load(ExecutionControl.ClassBytecodes[] cbcs) throws ExecutionControl.ClassInstallException, ExecutionControl.NotImplementedException, ExecutionControl.EngineTerminationExceptionAttempts to load new classes.- Parameters:
cbcs
- the class name and bytecodes to load- Throws:
ExecutionControl.ClassInstallException
- exception occurred loading the classes, some or all were not loadedExecutionControl.NotImplementedException
- if not implementedExecutionControl.EngineTerminationException
- the execution engine has terminated
-
redefine
void redefine(ExecutionControl.ClassBytecodes[] cbcs) throws ExecutionControl.ClassInstallException,
-