public class V8Executor extends Thread
Thread.State, Thread.UncaughtExceptionHandlerMAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY| Constructor and Description |
|---|
V8Executor(String script)
Create a new executor and execute the given script on it.
|
V8Executor(String script,
boolean longRunning,
String messageHandler)
Create a new executor and execute the given script on it.
|
| Modifier and Type | Method and Description |
|---|---|
void |
forceTermination()
Forces the executor to shutdown immediately.
|
Exception |
getException()
Gets the exception that was thrown during the JavaScript execution.
|
String |
getResult()
Gets the result of the JavaScript that was executed
on this executor.
|
boolean |
hasException()
Determines if an exception was thrown during the JavaScript execution.
|
boolean |
hasTerminated()
Determines if the executor has terminated.
|
boolean |
isShuttingDown()
Returns true if shutdown() or forceTermination() was called to
shutdown this executor.
|
boolean |
isTerminating()
Returns true if forceTermination was called to shutdown
this executor.
|
void |
postMessage(String... message)
Posts a message to the receiver to be processed by the executor
and sent to the V8 runtime via the messageHandler.
|
void |
run() |
protected void |
setup(V8 runtime)
Override to provide a custom setup for this V8 runtime.
|
void |
shutdown()
Indicates to the executor that it should shutdown.
|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yieldpublic V8Executor(String script, boolean longRunning, String messageHandler)
script - The script to execute on this executor.longRunning - True to indicate that this executor should be longRunning.messageHandler - The name of the message handler that should be notified
when messages are delivered.public V8Executor(String script)
script - The script to execute on this executor.protected void setup(V8 runtime)
runtime - The runtime to configure.public String getResult()
public void postMessage(String... message)
message - The message to send to the messageHandlerpublic boolean hasException()
public Exception getException()
public boolean hasTerminated()
public void forceTermination()
public void shutdown()
public boolean isShuttingDown()
public boolean isTerminating()
Copyright © 2015. All rights reserved.