Package gri.tasks

Examples of gri.tasks.AsyncTaskController


 
  public Map execute(Map inputs) throws Exception {
    JobSubmission submission = new JobSubmission(taskId, inputs);
    String jobId = jobManager.submitJob(submission);
   
    AsyncTaskController controller = jobManager.getJobController(jobId);
    PauseController pauser = new ConstantPause(3000);
    while (!controller.isComplete()) {
      try {
        pauser.pause();
      }
      catch(InterruptedException e) {
        throw e;  //why not?
      }
    }
   
    Map outputs = controller.getOutputs();
   
    if (freeJob)
      controller.free();
   
    return outputs;
  }
View Full Code Here


    AsyncTask task = tasks.getAsyncTask(submission.getTaskId());
      //NOTE: This is first so that we can easily throw UnknownTaskExceptions
   
    String jobId = createJobId()//TODO: synchronize and error check until jobs.put()?
   
    AsyncTaskController controller = task.start(
        submission.getInputs(),
        submission.getEventHandler());
   
    JobEntry jobEntry = new JobEntry(jobId, submission, controller);
    jobs.put(jobId, jobEntry);
View Full Code Here

        try {
            String jobKey = jobManager.submitJob(job);
            System.out.println("Submitted: " + jobKey);

            AsyncTaskController control = jobManager.getJobController(jobKey);
            while (control.getStatus() != JobManager.COMPLETE) {
                Thread.sleep(500);
                System.out.println("Checking (" + System.currentTimeMillis() + ") ...");
            }

            System.out.println("Complete");
View Full Code Here

          return;

        if (choice == JOptionPane.OK_OPTION) {
          JobEntry [] jobEntries = statusFrame.listJobs();
          for (int i=0; i<jobEntries.length; i++) {
            AsyncTaskController controller = jobEntries[i].getController();
            if (!controller.isComplete())
              controller.kill();
          }
        }
      }

      //free unfreed jobs (if indicated):
View Full Code Here

      if (choice == JOptionPane.OK_OPTION) {

        for (int i=0; i<runningJobs.size(); i++) {
          JobEntry job = (JobEntry)runningJobs.get(i);
          AsyncTaskController control = job.getController();
          if (!control.isComplete())
            control.kill();
        }
      }
    }

    //free unfreed jobs (if indicated):
View Full Code Here

TOP

Related Classes of gri.tasks.AsyncTaskController

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.