public final class MainThread extends Thread
Thread.State, Thread.UncaughtExceptionHandler
Modifier and Type | Field and Description |
---|---|
private String[] |
agents |
private String[] |
args |
private static boolean |
dbg |
protected boolean |
launched |
private RVMMethod |
mainMethod |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
Constructor and Description |
---|
MainThread(String[] args)
Create "main" thread.
|
Modifier and Type | Method and Description |
---|---|
(package private) RVMMethod |
getMainMethod() |
void |
run()
Run "main" thread.
|
private static void |
runAgent(Instrumentation instrumenter,
ClassLoader cl,
String agentJar,
String agentOptions) |
private void |
runAgents(ClassLoader cl) |
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, yield
private RVMMethod mainMethod
protected boolean launched
private static final boolean dbg
public MainThread(String[] args)
args
- args[0]
: name of class containing "main" method;
args[1..N]
: parameters to pass to "main" methodprivate void runAgents(ClassLoader cl)
private static void runAgent(Instrumentation instrumenter, ClassLoader cl, String agentJar, String agentOptions)
RVMMethod getMainMethod()
public void run()
This code could be made a little shorter by relying on Reflection to do the classloading and compilation. We intentionally do it here to give us a chance to provide error messages that are specific to not being able to find the main class the user wants to run. This may be a little silly, since it results in code duplication just to provide debug messages in a place where very little is actually likely to go wrong, but there you have it....