|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.grid.jgrid.Job
This class represents a job to be executed by the compute engine.
Field Summary | |
private java.lang.String |
annotation
The URL from whence the Computable implementation was loaded |
private boolean |
asynch
Whether this job is to be executed asynchronously or not |
static int |
COMPLETE
The job has completed normally |
private java.lang.Thread |
computeThread
The thread under which this Job runs. |
static int |
ERROR
The Job was stopped due to an error during execution |
private java.lang.String |
filename
The absolute filename where the serialized Job is written |
private Computable |
job
The object to process |
private java.lang.String |
jobId
The id of this job |
private Logger |
log
The logging mechanism for jobs |
static int |
NOT_STARTED
The Job has not been started |
private java.io.Serializable |
results
The results returned from the executing Computable |
static int |
RUNNING
The Job is currently running |
private int |
state
The current state of the Job, as represented by NOT_STARTED, RUNNING, STOPPED, COMPLETE, and ERROR |
static int |
STOPPED
The Job has been stopped before completing |
static int |
STOPPING
The Job iss being stopped before completing |
static int |
SUSPENDED
The Job has been suspended |
static int |
SUSPENDING
The Job is being suspended |
Constructor Summary | |
Job(java.lang.String jobId,
Computable job)
Creates a new instance of Job |
|
Job(java.lang.String jobId,
Computable job,
boolean asynch)
Creates a new instance of Job |
Method Summary | |
void |
cancel()
Notifies this job that it should cancel execution. |
void |
checkpoint()
Notifies this job that it should save its state for an upcoming checkpoint. |
boolean |
completed()
Checks whether or not this job has completed execution normally. |
java.lang.String |
getAnnotation()
Gets the URL from which the Computable implementation was downloaded. |
java.lang.String |
getFilename()
Get the path to the serialized Job file |
Computable |
getJob()
Returns the object to process |
java.lang.String |
getJobId()
Returns the id of this job |
Logger |
getLogger()
Returns the logging mechanism to eb used by the Computable for reporting errors and logging messages. |
java.io.Serializable |
getResult()
Get the result object returned by the Computable upon successful completion. |
int |
getState()
Returns the current state of the Job. |
void |
interrupt()
Interrupts the Job thread. |
boolean |
isAsynch()
Returns whether or not this job should be executed asynchronously |
void |
resume()
Notifies this job that it should resume execution. |
void |
run()
This method causes the job to be executed. |
void |
setAnnotation(java.lang.String annotation)
Sets the URL from which the Computable implementation was downloaded. |
void |
setFilename(java.lang.String filename)
Sets the location for the serialized Job file |
void |
setLogger(Logger log)
Sets the logging mechanism to be used by this job |
void |
suspend()
Notifies this job that it should suspend execution. |
private void |
writeJobToDisk()
Serializes the Job to the location given by filename . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int NOT_STARTED
public static final int RUNNING
public static final int SUSPENDED
public static final int STOPPED
public static final int COMPLETE
public static final int ERROR
public static final int SUSPENDING
public static final int STOPPING
private java.io.Serializable results
private transient java.lang.Thread computeThread
private java.lang.String filename
private java.lang.String jobId
private Computable job
private boolean asynch
private transient Logger log
private int state
private transient java.lang.String annotation
Constructor Detail |
public Job(java.lang.String jobId, Computable job)
jobId
- the id of this jobjob
- the object to processpublic Job(java.lang.String jobId, Computable job, boolean asynch)
jobId
- the id of this jobjob
- the object to processasynch
- whether this job should be executed asynchronouslyMethod Detail |
public java.lang.String getJobId()
public Computable getJob()
public boolean isAsynch()
public Logger getLogger()
public void setLogger(Logger log)
log
- The Logger to be used by this Jobpublic void run()
run
in interface java.lang.Runnable
public void cancel() throws NotInterruptableException
NotInterruptableException
- Thrown if the Computable does not implement interruption for cancelation.public void checkpoint() throws NotInterruptableException
filename
.
NotInterruptableException
- Thrown if the Computable does not implement interruption for checkpointing.public void suspend() throws NotInterruptableException
NotInterruptableException
- Thrown if the Computable does not implement interruption for suspension.public void resume()
public boolean completed()
getState() == COMPLETE
.
public int getState()
public java.io.Serializable getResult()
null
is returned.public void setFilename(java.lang.String filename)
filename
- The absolute path to the serialized Jobpublic java.lang.String getFilename()
public void setAnnotation(java.lang.String annotation)
annotation
- The URL from which the Computable implementation was downloadedpublic java.lang.String getAnnotation()
public void interrupt()
private void writeJobToDisk() throws java.io.IOException
filename
.
java.io.IOException
- Thrown is there's an error writing the Job to disk
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |