jist.runtime
Class Main

java.lang.Object
  extended by jist.runtime.Main

public final class Main
extends java.lang.Object

Primary entry-point into the JIST system. Performs cmd-line parsing, and general initialisation of the simulation system.

Since:
JIST1.0
Version:
$Id: Main.java,v 1.95 2004/06/09 18:54:17 barr Exp $
Author:
Rimon Barr <barr+jist@cs.cornell.edu>

Nested Class Summary
static class Main.CommandLineOptions
          Parsed JiST command-line options.
 
Field Summary
static boolean ASSERT
          Whether certain checks should be turned on.
static long CLIENT_PING_INTERVAL
          Interval between JiST server pings to client.
static long CONTROLLER_DISPLAY_INTERVAL
          Interval between JiST controller progress output.
static boolean COUNT_EVENTS
          Whether to count up events of each type.
private static RemoteJist.Job currentJob
          current job.
static boolean EVENT_LOCATION
          debugging: whether to compute event locations (high overhead).
static boolean EVENT_TRACE
          debugging: whether to keep event traces (some overhead).
static int EVENT_TRACE_DEPTH
          debugging: event causality trace depth
static int GUILOG_SIZE
          Event window size of GUI log.
static int JIST_PORT
          Default jist server (RMI) port.
static java.lang.String JIST_PROPERTIES
          Default jist properties file name.
static boolean REWRITE_CACHE
          Whether rewritten classes should be cached.
private static boolean running
          whether jist is running.
static long SERVER_DISPLAY_INTERVAL
          Interval between JiST server progress output to job queue.
static long SERVER_QUEUE_RELEASE_INTERVAL
          Interval for queue to check that server is still alive.
static boolean SINGLE_CONTROLLER
          Whether to assume a single controller.
static java.lang.String VERSION
          JiST version.
 
Constructor Summary
Main()
           
 
Method Summary
static boolean isRunning()
          Return whether JiST is running.
static void jobPump(RemoteJist.JobQueueServerRemote jqs)
          Dequeue and process jobs from queue.
static void main(java.lang.String[] args)
          JiST command-line entry point.
private static Main.CommandLineOptions parseCommandLineOptions(java.lang.String[] args)
          Parse command-line arguments.
static void recycleMem()
          Try to force a flush of all memory from previous simulation.
static void runClient(Main.CommandLineOptions options)
          Run a JiST client.
static void runServer(java.lang.String host, Main.CommandLineOptions options)
          Run a JiST server.
static void runSimulation(Main.CommandLineOptions options, java.util.Properties properties, RemoteJist.JistClientRemote remote, java.io.PrintStream serverOut, RemoteJist.PingRemote ping)
          Run a single simulation with given command-line options.
static void runSimulationRedirect(Main.CommandLineOptions options, java.util.Properties properties, RemoteJist.JistClientRemote remote)
          Redirect output streams and run simulation.
static void showUsage()
          Display JiST syntax help.
static void showVersion()
          Display JiST version information.
static java.lang.Thread startClientPingThread(RemoteJist.PingRemote ping, Controller controller)
          Initiate a server thread to ping client, and abort simulation if client dies.
static java.lang.Thread startDisplayThread(RemoteJist.JobQueueServerRemote jqs)
          Start server display thread to report simulation status to server queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION

public static final java.lang.String VERSION
JiST version.

See Also:
Constant Field Values

EVENT_TRACE

public static final boolean EVENT_TRACE
debugging: whether to keep event traces (some overhead).

See Also:
Constant Field Values

EVENT_TRACE_DEPTH

public static final int EVENT_TRACE_DEPTH
debugging: event causality trace depth. (0=no cut-off, beware: will accumulate everything)

See Also:
Constant Field Values

EVENT_LOCATION

public static final boolean EVENT_LOCATION
debugging: whether to compute event locations (high overhead).

See Also:
Constant Field Values

REWRITE_CACHE

public static final boolean REWRITE_CACHE
Whether rewritten classes should be cached.

See Also:
Constant Field Values

ASSERT

public static final boolean ASSERT
Whether certain checks should be turned on. (Java 1.3.x compatibility)

See Also:
Constant Field Values

COUNT_EVENTS

public static final boolean COUNT_EVENTS
Whether to count up events of each type.

See Also:
Constant Field Values

SINGLE_CONTROLLER

public static final boolean SINGLE_CONTROLLER
Whether to assume a single controller.

See Also:
Constant Field Values

GUILOG_SIZE

public static final int GUILOG_SIZE
Event window size of GUI log.

See Also:
Constant Field Values

CONTROLLER_DISPLAY_INTERVAL

public static final long CONTROLLER_DISPLAY_INTERVAL
Interval between JiST controller progress output.

See Also:
Constant Field Values

SERVER_DISPLAY_INTERVAL

public static final long SERVER_DISPLAY_INTERVAL
Interval between JiST server progress output to job queue.

See Also:
Constant Field Values

CLIENT_PING_INTERVAL

public static final long CLIENT_PING_INTERVAL
Interval between JiST server pings to client.

See Also:
Constant Field Values

SERVER_QUEUE_RELEASE_INTERVAL

public static final long SERVER_QUEUE_RELEASE_INTERVAL
Interval for queue to check that server is still alive.

See Also:
Constant Field Values

JIST_PORT

public static final int JIST_PORT
Default jist server (RMI) port.

See Also:
Constant Field Values

JIST_PROPERTIES

public static final java.lang.String JIST_PROPERTIES
Default jist properties file name.

See Also:
Constant Field Values

running

private static boolean running
whether jist is running.


currentJob

private static RemoteJist.Job currentJob
current job.

Constructor Detail

Main

public Main()
Method Detail

showVersion

public static void showVersion()
Display JiST version information.


showUsage

public static void showUsage()
Display JiST syntax help.


parseCommandLineOptions

private static Main.CommandLineOptions parseCommandLineOptions(java.lang.String[] args)
                                                        throws jargs.gnu.CmdLineParser.OptionException,
                                                               java.net.UnknownHostException
Parse command-line arguments.

Parameters:
args - command-line arguments
Returns:
command-line options structure
Throws:
CmdLineParser.OptionException - illegal command line option
java.net.UnknownHostException - unable to parse remote host address:port

isRunning

public static boolean isRunning()
Return whether JiST is running.

Returns:
whether JiST is running

runSimulation

public static void runSimulation(Main.CommandLineOptions options,
                                 java.util.Properties properties,
                                 RemoteJist.JistClientRemote remote,
                                 java.io.PrintStream serverOut,
                                 RemoteJist.PingRemote ping)
Run a single simulation with given command-line options.

Parameters:
options - command-line options
properties - jist properties
remote - jist client stub
serverOut - local server output stream; null for local execution
ping - remote client ping object, or null if local

runSimulationRedirect

public static void runSimulationRedirect(Main.CommandLineOptions options,
                                         java.util.Properties properties,
                                         RemoteJist.JistClientRemote remote)
Redirect output streams and run simulation.

Parameters:
options - command-line options
properties - jist properties
remote - jist client stub

runClient

public static void runClient(Main.CommandLineOptions options)
                      throws java.net.MalformedURLException,
                             java.rmi.NotBoundException,
                             java.rmi.RemoteException
Run a JiST client.

Parameters:
options - command-line options
Throws:
java.net.MalformedURLException - never
java.rmi.NotBoundException - remote JiST server not initialized
java.rmi.RemoteException - rpc failure

recycleMem

public static void recycleMem()
                       throws java.lang.InterruptedException
Try to force a flush of all memory from previous simulation.

Throws:
java.lang.InterruptedException - local server simulation thread interuptted

jobPump

public static void jobPump(RemoteJist.JobQueueServerRemote jqs)
                    throws java.rmi.RemoteException,
                           java.lang.InterruptedException
Dequeue and process jobs from queue.

Parameters:
jqs - (remote) job queue
Throws:
java.rmi.RemoteException - rpc failure
java.lang.InterruptedException - local server simulation thread interuptted

startDisplayThread

public static java.lang.Thread startDisplayThread(RemoteJist.JobQueueServerRemote jqs)
Start server display thread to report simulation status to server queue.

Parameters:
jqs - remote job queue server
Returns:
display thread

startClientPingThread

public static java.lang.Thread startClientPingThread(RemoteJist.PingRemote ping,
                                                     Controller controller)
Initiate a server thread to ping client, and abort simulation if client dies.

Parameters:
ping - remote ping object, or null if local
controller - controller running simulation
Returns:
ping thread, or null if ping object is null

runServer

public static void runServer(java.lang.String host,
                             Main.CommandLineOptions options)
                      throws java.net.MalformedURLException,
                             java.rmi.NotBoundException,
                             java.rmi.AlreadyBoundException,
                             java.rmi.RemoteException,
                             java.lang.InterruptedException
Run a JiST server.

Parameters:
host - server name
options - command-line options
Throws:
java.net.MalformedURLException - never
java.rmi.NotBoundException - remote JiST server not initialized
java.rmi.AlreadyBoundException - unable to initialize local server
java.rmi.RemoteException - rpc failure
java.lang.InterruptedException - local server simulation thread interuptted

main

public static void main(java.lang.String[] args)
JiST command-line entry point.

Parameters:
args - command-line arguments