AutoCloseable, ExecutionControlLocalExecutionControl, RemoteExecutionControlpublic class DirectExecutionControl extends Object implements ExecutionControl
ExecutionControl implementation that runs in the current process.
May be used directly, or over a channel with
Util.forwardExecutionControl(ExecutionControl, java.io.ObjectInput, java.io.ObjectOutput).ExecutionControl.ClassBytecodes, ExecutionControl.ClassInstallException, ExecutionControl.EngineTerminationException, ExecutionControl.ExecutionControlException, ExecutionControl.InternalException, ExecutionControl.NotImplementedException, ExecutionControl.ResolutionException, ExecutionControl.RunException, ExecutionControl.StoppedException, ExecutionControl.UserException| Constructor | Description |
|---|---|
DirectExecutionControl() |
Create an instance using the default class loading.
|
DirectExecutionControl(LoaderDelegate loaderDelegate) |
Creates an instance, delegating loader operations to the specified
delegate.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
addToClasspath(String cp) |
Adds the path to the execution class path.
|
protected void |
clientCodeEnter() |
Marks entry into user code.
|
protected void |
clientCodeLeave() |
Marks departure from user code.
|
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).
|
protected Class<?> |
findClass(String name) |
Finds the class with the specified binary name.
|
protected String |
invoke(Method doitMethod) |
Invoke the specified "doit-method", a static method with no parameters.
|
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.
|
protected String |
throwConvertedInvocationException(Throwable cause) |
Converts incoming exceptions in user code into instances of subtypes of
ExecutionControl.ExecutionControlException and throws the
converted exception. |
protected String |
throwConvertedOtherException(Throwable ex) |
Converts incoming exceptions in agent code into instances of subtypes of
ExecutionControl.ExecutionControlException and throws the
converted exception. |
protected static String |
valueString(Object value) |
Converts the
Object value from
ExecutionControl.invoke(String, String) or
ExecutionControl.varValue(String, String) to String. |
String |
varValue(String className,
String varName) |
Returns the value of a variable.
|
generate, generatepublic DirectExecutionControl(LoaderDelegate loaderDelegate)
loaderDelegate - the delegate to handle loading classespublic DirectExecutionControl()
public void load(ExecutionControl.ClassBytecodes[] cbcs) throws ExecutionControl.ClassInstallException, ExecutionControl.NotImplementedException, ExecutionControl.EngineTerminationException
ExecutionControlload in interface ExecutionControlcbcs - 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 terminatedpublic void redefine(ExecutionControl.ClassBytecodes[] cbcs) throws ExecutionControl.ClassInstallException, ExecutionControl.NotImplementedException, ExecutionControl.EngineTerminationException
ExecutionControlredefine in interface ExecutionControlcbcs - 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 terminatedpublic String invoke(String className, String methodName) throws ExecutionControl.RunException, ExecutionControl.InternalException, ExecutionControl.EngineTerminationException
ExecutionControlinvoke in interface ExecutionControlclassName - 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
ExecutionControl.stop()ExecutionControl.InternalException - an internal problem occurredExecutionControl.EngineTerminationException - the execution engine has terminatedExecutionControl.RunExceptionpublic String varValue(String className, String varName) throws ExecutionControl.RunException, ExecutionControl.EngineTerminationException, ExecutionControl.InternalException
ExecutionControlvarValue in interface ExecutionControlclassName - 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
ExecutionControl.stop()ExecutionControl.EngineTerminationException - the execution engine has terminatedExecutionControl.InternalException - an internal problem occurredExecutionControl.RunExceptionpublic void addToClasspath(String cp) throws ExecutionControl.EngineTerminationException, ExecutionControl.InternalException
ExecutionControladdToClasspath in interface ExecutionControlcp - the path to addExecutionControl.EngineTerminationException - the execution engine has terminatedExecutionControl.InternalException - an internal problem occurredpublic void stop()
throws ExecutionControl.EngineTerminationException,
ExecutionControl.InternalException
Not supported.
stop in interface ExecutionControlExecutionControl.EngineTerminationException - the execution engine has terminatedExecutionControl.InternalException - an internal problem occurredpublic Object extensionCommand(String command, Object arg) throws ExecutionControl.RunException, ExecutionControl.EngineTerminationException, ExecutionControl.InternalException
ExecutionControlextensionCommand in interface ExecutionControlcommand - 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
ExecutionControl.stop()ExecutionControl.EngineTerminationException - the execution engine has terminatedExecutionControl.NotImplementedException - if not implementedExecutionControl.InternalException - an internal problem occurredExecutionControl.RunExceptionpublic void close()
ExecutionControlNo calls to methods on this interface should be made after close.
close in interface AutoCloseableclose in interface ExecutionControlprotected Class<?> findClass(String name) throws ClassNotFoundException
name - the binary name of the classClassNotFoundException - if the class could not be foundprotected String invoke(Method doitMethod) throws Exception
invoke(java.lang.String, java.lang.String)
in this class will call this to invoke.doitMethod - the Method to invokeException - any exceptions thrown by
Method.invoke(Object, Object...)
or any ExecutionControl.ExecutionControlException
to pass-through.protected static String valueString(Object value)
Object value from
ExecutionControl.invoke(String, String) or
ExecutionControl.varValue(String, String) to String.value - the value to convertString representationprotected String throwConvertedInvocationException(Throwable cause) throws ExecutionControl.RunException, ExecutionControl.InternalException
ExecutionControl.ExecutionControlException and throws the
converted exception.cause - the exception to convertExecutionControl.RunException - for normal exception occurrencesExecutionControl.InternalException - for internal problemsprotected String throwConvertedOtherException(Throwable ex) throws ExecutionControl.RunException, ExecutionControl.InternalException
ExecutionControl.ExecutionControlException and throws the
converted exception.ex - the exception to convertExecutionControl.RunException - for normal exception occurrencesExecutionControl.InternalException - for internal problemsprotected void clientCodeEnter()
throws ExecutionControl.InternalException
ExecutionControl.InternalException - in unexpected failure casesprotected void clientCodeLeave()
throws ExecutionControl.InternalException
ExecutionControl.InternalException - in unexpected failure cases Submit a bug or feature
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 2015, 2017, Oracle and/or its affiliates. 500 Oracle Parkway
Redwood Shores, CA 94065 USA. All rights reserved.
DRAFT 9-Debian+0-9b155-1