|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.peace_tools.core.JobMonitor
public class JobMonitor
A background thread class to monitor job progress. This is a background thread class that is created to monitor the progress of a Job. A job monitor is created either when a work space is loaded (and it has unfinished jobs pending) or when a new job is added to the work space. This class is not directly instantiable. Instead the create() method must be used to create a monitor thread.
Field Summary | |
---|---|
private Job |
job
The job that this monitor is monitoring. |
private java.awt.event.ActionListener |
listener
The action listener to be notified when this thread exists with a status of FINISHING or ERROR. |
private static java.lang.String |
PURPOSE_MSG
A static formatable purpose message that is filled in and used as the purpose for the server session initiated by this job monitor. |
private int |
recheckDelay
The delay in milliseconds for which the main thread must sleep before checking back for updates. |
private Server |
server
Information regarding the server on which the job (that this monitor is monitoring) is running. |
private ServerSession |
session
The session (local/remote) to the server on which the job is running. |
Constructor Summary | |
---|---|
private |
JobMonitor(Job job,
Server server,
java.awt.event.ActionListener listener)
The constructor merely initializes the instance variables to default values. |
Method Summary | |
---|---|
static boolean |
create(Job job,
java.awt.event.ActionListener listener)
The primary API method to create a job monitor thread. |
private boolean |
createSession()
This is a helper method that is periodically invoked to check and create a session to the remote server. |
static java.lang.Thread |
getMonitor(Job job)
Method to obtain an existing monitor thread for this job. |
static void |
interrupt(Job job)
Convenience method to interrupt a job monitor thread. |
void |
run()
|
private boolean |
updateJobStatus()
Helper method to run the jobRunner script on the remote machine and obtain the operational status of the job. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final Job job
private final java.awt.event.ActionListener listener
private final transient Server server
private transient ServerSession session
private transient int recheckDelay
private static final java.lang.String PURPOSE_MSG
Constructor Detail |
---|
private JobMonitor(Job job, Server server, java.awt.event.ActionListener listener)
job
- The job to be monitored by this job monitor.listener
- The action listener to be notified when this thread
exits.server
- Information regarding the server on which this
job is allegedly running.Method Detail |
---|
public static boolean create(Job job, java.awt.event.ActionListener listener)
job
- Information regarding the job to be monitored.listener
- The action listener to be notified when
the job has completed and this thread is about to be exited.
The action event posted has the command set to "JobMonitor"
and the object is set to the Job that has completed.
public static void interrupt(Job job)
job
- The job whose monitoring thread is to be interrupted.public static java.lang.Thread getMonitor(Job job)
job
- The job whose job monitor thread is to be returned.
public void run()
run
in interface java.lang.Runnable
private boolean updateJobStatus()
private boolean createSession()
Note: If a valid session could not be established this method will simply sleep for 5 minutes before returning control.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |