edu.sdsc.inca.agent.access
Class GlobusBlockingJobListener

java.lang.Object
  extended by edu.sdsc.inca.agent.access.GlobusBlockingJobListener
All Implemented Interfaces:
org.globus.gram.GramJobListener

public class GlobusBlockingJobListener
extends java.lang.Object
implements org.globus.gram.GramJobListener

Subclass of GramJobListener that can be used to create a blocking GRAM request. For example,

   GramJob job = new GramJob( rslString );
   GlobusBlockingJobListener listener = new GlobusBlockingJobListener();
   job.addListener( listener );
   job.request( gramContact );
     listener.waitFor();
 
Based on Java COG code for globusrun.

Author:
Shava Smallen <ssmallen@sdsc.edu>

Constructor Summary
GlobusBlockingJobListener()
           
 
Method Summary
 int getStatus()
          Get the status code for the Globus GRAM job.
 boolean hasFailed()
          Check for failure status of job.
 boolean hasFinished()
          Returns true if the job has finished.
 void statusChanged(org.globus.gram.GramJob job)
          This function is called by the COG API after the job.request call whenever the job status changes.
 void waitFor()
          Wait for the job to finish.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GlobusBlockingJobListener

public GlobusBlockingJobListener()
Method Detail

getStatus

public int getStatus()
Get the status code for the Globus GRAM job. Should be called after the job is finished.

Returns:
A constant from the GramJob class indicating the status of the job.

hasFinished

public boolean hasFinished()
Returns true if the job has finished.

Returns:
Returns true if the job status is either done or failed; false otherwise.

hasFailed

public boolean hasFailed()
Check for failure status of job.

Returns:
Returns true if the job status is failed.

statusChanged

public void statusChanged(org.globus.gram.GramJob job)
This function is called by the COG API after the job.request call whenever the job status changes.

Specified by:
statusChanged in interface org.globus.gram.GramJobListener
Parameters:
job - A pointer to the job that is running so the status can be retrieved.

waitFor

public void waitFor()
             throws java.lang.InterruptedException
Wait for the job to finish. Blocks until another thread notifies it and then checks the job status and returns if finished.

Throws:
java.lang.InterruptedException