gui.run
Class RunJob

java.lang.Object
  extended by gui.run.RunJob
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
CheckForDeathJobFile, CheckForDeathJobProperties

public abstract class RunJob
extends java.lang.Object
implements java.lang.Runnable


Field Summary
static int MAX_PRIORITY
          The maximum priority that a RunJob can have.
static int MIN_PRIORITY
          The minimum priority that a RunJob can have.
static int NORM_PRIORITY
          The default priority that is assigned to a RunJob.
 
Constructor Summary
RunJob(double seconds)
          Runs the doCommand() every seconds.
RunJob(double seconds, boolean wait)
          Run the RunJob every seconds If wait is true then do not start the RunJob until the start method is invoked.
RunJob(double seconds, boolean wait, int count)
          Run the RunJob every seconds If wait is true then do not start the RunJob until the start method is invoked.
RunJob(double seconds, boolean wait, int maximumNumberOfTimesToRun, boolean isDaemon)
          Run the RunJob every seconds If wait is true then do not start the RunJob until the start method is invoked.
RunJob(double seconds, boolean wait, int count, boolean isDaemon, int priority)
          Run the RunJob every seconds If wait is true then do not start the RunJob until the start method is invoked.
 
Method Summary
 java.lang.String getName()
          Gets the name of this RunJob (and the thread upon which the RunJob is based

First the checkAccess method of this thread is called with no arguments.

 int getNumberOfTimesRun()
           
 int getPriority()
          Returns this RunJob's priority.
 boolean isAlive()
          Tests if this RunJob is alive.
 boolean isDaemon()
          Tests if the RunJob is a daemon RunJob.
static void main(java.lang.String[] args)
           
 void setName(java.lang.String name)
          Changes the name of this RunJob (and thread upon which the RunJob is based, to be equal to the argument name.
 void setPriority(int priority)
          Changes the priority of this RunJob.
 void start()
          Start will restart a RunJob that was stopped.
 void stop()
          Stops the RunJob by causing a thread death.
 java.lang.String toString()
          Returns a string representation of this RunJob, including the RunJob's name, priority, and thread group to which the RunJob's thread belongs.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.lang.Runnable
run
 

Field Detail

MIN_PRIORITY

public static final int MIN_PRIORITY
The minimum priority that a RunJob can have.

See Also:
Constant Field Values

NORM_PRIORITY

public static final int NORM_PRIORITY
The default priority that is assigned to a RunJob.

See Also:
Constant Field Values

MAX_PRIORITY

public static final int MAX_PRIORITY
The maximum priority that a RunJob can have.

See Also:
Constant Field Values
Constructor Detail

RunJob

public RunJob(double seconds)
Runs the doCommand() every seconds. The job starts right away.


RunJob

public RunJob(double seconds,
              boolean wait)
Run the RunJob every seconds If wait is true then do not start the RunJob until the start method is invoked. Otherwise, start right away.


RunJob

public RunJob(double seconds,
              boolean wait,
              int count)
Run the RunJob every seconds If wait is true then do not start the RunJob until the start method is invoked. Otherwise, start right away. If the count is present, then the job only executes count.

Parameters:
count - Integer.MINVALUE is infinite

RunJob

public RunJob(double seconds,
              boolean wait,
              int maximumNumberOfTimesToRun,
              boolean isDaemon)
Run the RunJob every seconds If wait is true then do not start the RunJob until the start method is invoked. Otherwise, start right away. If the count is present, then the job only executes count. isDaemon Marks this RunJob as either a daemon RunJob or a user RunJob. The Java Virtual Machine exits when the only RunJobs running are all daemon RunJobs and all Threads are daemon threads. The default value for isDaemon is false.

Parameters:
seconds - seconds of wait between jobs
wait - true if you want to delay start
maximumNumberOfTimesToRun - number of times to execute. Integer.MINVALUE is infinite
isDaemon - true if you want to exit on main exit

RunJob

public RunJob(double seconds,
              boolean wait,
              int count,
              boolean isDaemon,
              int priority)
Run the RunJob every seconds If wait is true then do not start the RunJob until the start method is invoked. Otherwise, start right away. If the count is present, then the job only executes count. isDaemon Marks this RunJob as either a daemon RunJob or a user RunJob. The Java Virtual Machine exits when the only RunJobs running are all daemon RunJobs and all Threads are daemon threads. The default value for isDaemon is false.

Parameters:
seconds - seconds of wait between jobs
wait - true if you want to delay start
count - number of times to execute. Integer.MINVALUE is infinite
isDaemon - true if you want to exit on main exit
priority - the internal threads priority.
Method Detail

getNumberOfTimesRun

public int getNumberOfTimesRun()
Returns:
the number of times the RunJob was run.

setPriority

public void setPriority(int priority)
Changes the priority of this RunJob.

This may result in throwing a SecurityException.

Otherwise, the priority of this RunJob is set to the smaller of the specified newPriority and the maximum permitted priority of the RunJobs's thread group. If the priority is smaller than MIN_PRIORITY then it will be set to MIN_PRIORITY. If the priority is greater than MAX_PRIORITY then it will be set to MAX_PRIORITY. This avoids illegal arguments.

Parameters:
priority - priority to set this RunJob to
Throws:
java.lang.SecurityException - if the current RunJob cannot modify its thread.
See Also:
getPriority(), MAX_PRIORITY, MIN_PRIORITY

getPriority

public final int getPriority()
Returns this RunJob's priority.

Returns:
this RunJob's priority.
See Also:
setPriority(int), Thread.setPriority(int)

start

public void start()
Start will restart a RunJob that was stopped. It will also start a RunJob that was never started.


setName

public void setName(java.lang.String name)
Changes the name of this RunJob (and thread upon which the RunJob is based, to be equal to the argument name.

First the checkAccess method of this thread is called with no arguments. This may result in throwing a SecurityException.

Parameters:
name - the new name for this thread.

getName

public java.lang.String getName()
Gets the name of this RunJob (and the thread upon which the RunJob is based

First the checkAccess method of this thread is called with no arguments. This may result in throwing a SecurityException.


stop

public void stop()
Stops the RunJob by causing a thread death. A start() invocation Will make a new thread and restart the RunJob.


isDaemon

public boolean isDaemon()
Tests if the RunJob is a daemon RunJob.

Returns:
true if this RunJob is a daemon RunJob; false otherwise.

isAlive

public boolean isAlive()
Tests if this RunJob is alive. A RunJob is alive if it has been started and has not yet run for the requisite number of times.

Returns:
true if this RunJob is alive; false otherwise.

toString

public java.lang.String toString()
Returns a string representation of this RunJob, including the RunJob's name, priority, and thread group to which the RunJob's thread belongs.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of this thread.

main

public static void main(java.lang.String[] args)