- java.lang.Object
-
- jdk.jshell.execution.DirectExecutionControl
-
- jdk.jshell.execution.LocalExecutionControl
-
- All Implemented Interfaces:
AutoCloseable
,ExecutionControl
public class LocalExecutionControl extends DirectExecutionControl
An implementation ofExecutionControl
which executes in the same JVM as the JShell-core.- Since:
- 9
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jdk.jshell.spi.ExecutionControl
ExecutionControl.ClassBytecodes, ExecutionControl.ClassInstallException, ExecutionControl.EngineTerminationException, ExecutionControl.ExecutionControlException, ExecutionControl.InternalException, ExecutionControl.NotImplementedException, ExecutionControl.ResolutionException, ExecutionControl.RunException, ExecutionControl.StoppedException, ExecutionControl.UserException
-
-
Constructor Summary
Constructors Constructor Description LocalExecutionControl()
Create an instance using the default class loading.LocalExecutionControl(LoaderDelegate loaderDelegate)
Creates an instance, delegating loader operations to the specified delegate.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
clientCodeEnter()
Marks entry into user code.protected void
clientCodeLeave()
Marks departure from user code.protected String
invoke(Method doitMethod)
Invoke the specified "doit-method", a static method with no parameters.void
stop()
Interrupts a running invoke.-
Methods inherited from class jdk.jshell.execution.DirectExecutionControl
addToClasspath, classesRedefined, close, extensionCommand, findClass, invoke, load, redefine, throwConvertedInvocationException, throwConvertedOtherException, valueString, varValue
-
Methods inherited from interface jdk.jshell.spi.ExecutionControl
generate, generate
-
-
-
-
Constructor Detail
-
LocalExecutionControl
public LocalExecutionControl(LoaderDelegate loaderDelegate)
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.
-
-
Method Detail
-
invoke
protected String invoke(Method doitMethod) throws Exception
Description copied from class:DirectExecutionControl
Invoke 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:
invoke
in classDirectExecutionControl
- Parameters:
doitMethod
- the Method to invoke- Returns:
- the value or null
- Throws:
Exception
- any exceptions thrown byMethod.invoke(Object, Object...)
or anyExecutionControl.ExecutionControlException
to pass-through.
-
stop
public void stop() throws ExecutionControl.EngineTerminationException, ExecutionControl.InternalException
Description copied from class:DirectExecutionControl
Interrupts a running invoke.Not supported.
- Specified by:
stop
in interfaceExecutionControl
- Overrides:
stop
in classDirectExecutionControl
- Throws:
ExecutionControl.EngineTerminationException
- the execution engine has terminatedExecutionControl.InternalException
- an internal problem occurred
-
clientCodeEnter
protected void clientCodeEnter()
Description copied from class:DirectExecutionControl
Marks entry into user code.- Overrides:
clientCodeEnter
in classDirectExecutionControl
-
clientCodeLeave
protected void clientCodeLeave()
Description copied from class:DirectExecutionControl
Marks departure from user code.- Overrides:
clientCodeLeave
in classDirectExecutionControl
-
-