org.jikesrvm.scheduler
Class MainThread

java.lang.Object
  extended by java.lang.Thread
      extended by org.jikesrvm.scheduler.MainThread
All Implemented Interfaces:
Runnable

public final class MainThread
extends Thread

Thread in which user's "main" program runs.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
private  String[] agents
           
private  String[] args
           
private static boolean dbg
           
protected  boolean launched
           
private  RVMMethod mainMethod
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
MainThread(String[] args)
          Create "main" thread.
 
Method Summary
(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)
           
 
Methods inherited from class java.lang.Thread
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
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

args

private final String[] args

agents

private final String[] agents

mainMethod

private RVMMethod mainMethod

launched

protected boolean launched

dbg

private static final boolean dbg
See Also:
Constant Field Values
Constructor Detail

MainThread

public MainThread(String[] args)
Create "main" thread.

Parameters:
args - args[0]: name of class containing "main" method; args[1..N]: parameters to pass to "main" method
Method Detail

runAgents

private void runAgents(ClassLoader cl)

runAgent

private static void runAgent(Instrumentation instrumenter,
                             ClassLoader cl,
                             String agentJar,
                             String agentOptions)

getMainMethod

RVMMethod getMainMethod()

run

public void run()
Run "main" thread.

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....

Specified by:
run in interface Runnable
Overrides:
run in class Thread