public interface ExecutionControl
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.
To install an ExecutionControl
, it's Generator
is passed to
JShell.Builder.executionEngine(ExecutionControl.Generator)
.
Modifier and Type | Interface and Description |
---|---|
static class |
ExecutionControl.ClassBytecodes |
static class |
ExecutionControl.ClassInstallException |
static class |
ExecutionControl.EngineTerminationException
Unbidden execution engine termination has occurred.
|
static class |
ExecutionControl.ExecutionControlException |
static interface |
ExecutionControl.Generator |
static class |
ExecutionControl.InternalException |
static class |
ExecutionControl.NotImplementedException |
static class |
ExecutionControl.ResolutionException |
static class |
ExecutionControl.RunException |
static class |
ExecutionControl.StoppedException |
static class |
ExecutionControl.UserException |
Modifier and Type | Method and 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).
|
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 |
setClasspath(String path)
Sets the execution class path to the specified path.
|
void |
stop()
Interrupts a running invoke.
|
String |
varValue(String className,
String varName)
Returns the value of a variable.
|
void load(ExecutionControl.ClassBytecodes[] cbcs) throws ExecutionControl.ClassInstallException, ExecutionControl.NotImplementedException, ExecutionControl.EngineTerminationException
cbcs
- the class name and bytecodes to loadExecutionControl.ClassInstallException
- exception occurred loading the classes,
some or all were not loadedExecutionControl.NotImplementedException
- if not implementedExecutionControl.EngineTerminationException
- the execution engine has terminatedvoid redefine(ExecutionControl.ClassBytecodes[] cbcs) throws ExecutionControl.ClassInstallException, ExecutionControl.NotImplementedException, ExecutionControl.EngineTerminationException
cbcs
- the class name and bytecodes to redefineExecutionControl.ClassInstallException
- exception occurred redefining the classes,
some or all were not redefinedExecutionControl.NotImplementedException
- if not implementedExecutionControl.EngineTerminationException
- the execution engine has terminatedString invoke(String className, String methodName) throws ExecutionControl.RunException, ExecutionControl.EngineTerminationException, ExecutionControl.InternalException
className
- the class whose method should be invokedmethodName
- the name of method to invokeExecutionControl.UserException
- the invoke raised a user exceptionExecutionControl.ResolutionException
- the invoke attempted to directly or
indirectly invoke an unresolved snippetExecutionControl.StoppedException
- if the invoke()
was canceled by
stop()
ExecutionControl.EngineTerminationException
- the execution engine has terminatedExecutionControl.InternalException
- an internal problem occurredExecutionControl.RunException
String varValue(String className, String varName) throws ExecutionControl.RunException, ExecutionControl.EngineTerminationException, ExecutionControl.InternalException
className
- the name of the wrapper class of the variablevarName
- the name of the variableExecutionControl.UserException
- formatting the value raised a user exceptionExecutionControl.ResolutionException
- formatting the value attempted to directly or
indirectly invoke an unresolved snippetExecutionControl.StoppedException
- if the formatting the value was canceled by
stop()
ExecutionControl.EngineTerminationException
- the execution engine has terminatedExecutionControl.InternalException
- an internal problem occurredExecutionControl.RunException
void addToClasspath(String path) throws ExecutionControl.EngineTerminationException, ExecutionControl.InternalException
path
- the path to addExecutionControl.EngineTerminationException
- the execution engine has terminatedExecutionControl.InternalException
- an internal problem occurredvoid setClasspath(String path) throws ExecutionControl.EngineTerminationException, ExecutionControl.InternalException
path
- the path to addExecutionControl.EngineTerminationException
- the execution engine has terminatedExecutionControl.InternalException
- an internal problem occurredvoid stop() throws ExecutionControl.EngineTerminationException, ExecutionControl.InternalException
ExecutionControl.EngineTerminationException
- the execution engine has terminatedExecutionControl.InternalException
- an internal problem occurredObject extensionCommand(String command, Object arg) throws ExecutionControl.RunException, ExecutionControl.EngineTerminationException, ExecutionControl.InternalException
command
- the non-standard commandarg
- the commands argumentExecutionControl.UserException
- the command raised a user exceptionExecutionControl.ResolutionException
- the command attempted to directly or
indirectly invoke an unresolved snippetExecutionControl.StoppedException
- if the command was canceled by
stop()
ExecutionControl.EngineTerminationException
- the execution engine has terminatedExecutionControl.NotImplementedException
- if not implementedExecutionControl.InternalException
- an internal problem occurredExecutionControl.RunException
void close()
No calls to methods on this interface should be made after close.
Copyright © 2015, 2016, Oracle and/or its affiliates. All rights reserved.
DRAFT 9-internal+0-2016-07-11-224625.robert.dev