Class LocalExecutionControl
java.lang.Object
jdk.jshell.execution.DirectExecutionControl
jdk.jshell.execution.LocalExecutionControl
- All Implemented Interfaces:
AutoCloseable, ExecutionControl
An implementation of
ExecutionControl which executes
in the same JVM as the JShell-core.- Since:
- 9
-
Nested Class Summary
Nested classes/interfaces inherited from interface ExecutionControl
ExecutionControl.ClassBytecodes, ExecutionControl.ClassInstallException, ExecutionControl.EngineTerminationException, ExecutionControl.ExecutionControlException, ExecutionControl.InternalException, ExecutionControl.NotImplementedException, ExecutionControl.ResolutionException, ExecutionControl.RunException, ExecutionControl.StoppedException, ExecutionControl.UserException -
Constructor Summary
ConstructorsConstructorDescriptionCreate an instance using the default class loading, which delegates to the system class loader.LocalExecutionControl(ClassLoader parent) Create an instance using the default class loading, but delegating to the specified parent class loader.LocalExecutionControl(LoaderDelegate loaderDelegate) Creates an instance, delegating loader operations to the specified delegate. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidMarks entry into user code.protected voidMarks departure from user code.protected StringInvoke the specified "doit-method", a static method with no parameters.voidload(ExecutionControl.ClassBytecodes[] cbcs) Attempts to load new classes.voidstop()Interrupts a running invoke.Methods inherited from class DirectExecutionControl
addToClasspath, classesRedefined, close, extensionCommand, findClass, invoke, redefine, throwConvertedInvocationException, throwConvertedOtherException, valueString, varValue
-
Constructor Details
-
LocalExecutionControl
Creates an instance, delegating loader operations to the specified delegate.- Parameters:
loaderDelegate- the delegate to handle loading classes
-
LocalExecutionControl
public LocalExecutionControl()Create an instance using the default class loading, which delegates to the system class loader. -
LocalExecutionControl
Create an instance using the default class loading, but delegating to the specified parent class loader.- Parameters:
parent- parent class loader- Since:
- 22
-
-
Method Details
-
load
public void load(ExecutionControl.ClassBytecodes[] cbcs) throws ExecutionControl.ClassInstallException, ExecutionControl.NotImplementedException, ExecutionControl.EngineTerminationException Description copied from interface:ExecutionControlAttempts to load new classes.- Specified by:
loadin interfaceExecutionControl- Overrides:
loadin classDirectExecutionControl- 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
-
invoke
Description copied from class:DirectExecutionControlInvoke the specified "doit-method", a static method with no parameters. TheDirectExecutionControl.invoke(java.lang.String, java.lang.String)in this class will call this to invoke.- Overrides:
invokein classDirectExecutionControl- Parameters:
doitMethod- the Method to invoke- Returns:
- the value or null
- Throws:
Exception- any exceptions thrown byMethod.invoke(Object, Object...)or anyExecutionControl.ExecutionControlExceptionto pass-through.
-
stop
public void stop() throws ExecutionControl.EngineTerminationException, ExecutionControl.InternalExceptionDescription copied from class:DirectExecutionControlInterrupts a running invoke.Not supported.
- Specified by:
stopin interfaceExecutionControl- Overrides:
stopin classDirectExecutionControl- Throws:
ExecutionControl.EngineTerminationException- the execution engine has terminatedExecutionControl.InternalException- an internal problem occurred
-
clientCodeEnter
protected void clientCodeEnter()Description copied from class:DirectExecutionControlMarks entry into user code.- Overrides:
clientCodeEnterin classDirectExecutionControl
-
clientCodeLeave
protected void clientCodeLeave()Description copied from class:DirectExecutionControlMarks departure from user code.- Overrides:
clientCodeLeavein classDirectExecutionControl
-