Package com.sun.grid.jgrid

Examples of com.sun.grid.jgrid.Job


   * @throws CommandFailedException thrown if this method cannot complete its task due to errors or failures
   */ 
  public void unregister (String jobId) throws CommandFailedException {
    log.entering ("com.sun.grid.jgrid.server.JCEPHandler", "unregister");
   
    Job job = (Job)jobMap.get (jobId);
   
    if (job == null) {
      log.finer ("Unegister command failed for job " + jobId + ": No such job");
     
      throw new CommandFailedException (jobId, "No such job");
    }
    else {
      job.getLogger ().unregisterHandler (this);
   
      log.fine ("Connection has been unregistered with job: " + jobId);
    }

    log.exiting ("com.sun.grid.jgrid.server.JCEPHandler", "unregister");
View Full Code Here


   * @throws CommandFailedException thrown if this method cannot complete its task due to errors or failures
   */ 
  public void cancelJob (String jobId) throws CommandFailedException {
    log.entering ("com.sun.grid.jgrid.server.JCEPHandler", "cancelJob");
   
    Job job = (Job)jobMap.get (jobId);
   
    if (job == null) {
      log.finer ("Cancel command failed for job " + jobId + ": No such job");
     
      throw new CommandFailedException (jobId, "No such job");
    }
    else if (job.getState () == Job.RUNNING) {
      try {
        job.cancel ();
   
        log.fine ("Job has been canceled: " + jobId);
      }
      catch (NotInterruptableException e) {
        log.finer ("Cancel command failed for job " + jobId + ": Job cannot be interrupted");
View Full Code Here

   * @throws CommandFailedException thrown if this method cannot complete its task due to errors or failures
   */ 
  public void checkpoint (String jobId) throws CommandFailedException {
    log.entering ("com.sun.grid.jgrid.server.JCEPHandler", "checkpoint");
   
    Job job = (Job)jobMap.get (jobId);
   
    if (job == null) {
      log.finer ("Checkpoint command failed for job " + jobId + ": No such job");
     
      throw new CommandFailedException (jobId, "No such job");
    }
    else if (job.getState () == Job.RUNNING) {
      try {
        job.checkpoint ();
       
        log.fine ("Job has been checkpointed: " + jobId);
      }
      catch (NotInterruptableException e) {
        log.finer ("Checkpoint command failed for job " + jobId + ": Job cannot be interrupted");
View Full Code Here

    String jobId = null;
    Iterator i = jobMap.keySet ().iterator ();
   
    while (i.hasNext ()) {
      jobId = (String)i.next ();
      Job job = (Job)jobMap.get (jobId);
 
      /* Every job will be canceled if possible.  Jobs that aren't interruptable
       * or that don't complete before the grace period is over will be stopped
       * prematurely by the VM exit. */
      if (job.getState () == job.RUNNING) {
        try {
          job.cancel ();
        }
        catch (NotInterruptableException e) {
          this.logError (jobId, "Job cannot be interrupted");
        }
      }
View Full Code Here

      /* Our channel is dead, so just use the log file */
      log.warning ("Unable to notify that job has exited: " + jobId);
      log.warning ("Problem caused by IOException:" + com.sun.grid.jgrid.Logger.getExceptionAsString (e));
    }
   
    Job job = (Job)jobMap.get (jobId);
   
    if (job == null) {
      log.severe ("Job " + jobId + " has exited but no longer exists in the job map");
    }
    else {
View Full Code Here

      /* Our channel is dead, so just use the log file */
      log.warning ("Unable to notify that job has exited: " + jobId);
      log.warning ("Problem caused by IOException:" + com.sun.grid.jgrid.Logger.getExceptionAsString (e));
    }
   
    Job job = (Job)jobMap.get (jobId);
   
    if (job == null) {
      log.severe ("Job " + jobId + " has exited but no longer exists in the job map");
    }
    else {
      Exception ex = null;
     
      try {
        resultChannel.sendException ((Exception)job.getResult (), jobId);
      }
      catch (RemoteException e) {
        this.logError (jobId, "Unable to sends results of job to result channel");
      }
    }
View Full Code Here

      /* Our channel is dead, so just use the log file */
      log.warning ("Unable to notify that job has completed: " + jobId);
      log.warning ("Problem caused by IOException:" + com.sun.grid.jgrid.Logger.getExceptionAsString (e));
    }
   
    Job job = (Job)jobMap.get (jobId);
   
    if (job == null) {
      log.severe ("Job " + jobId + " has completed but no longer exists in the job map");
    }
    else {
      try {
        resultChannel.sendResult (job.getResult (), jobId);
      }
      catch (RemoteException e) {
        this.logError (jobId, "Unable to sends results of job to result channel");
      }
    }
View Full Code Here

   * @see com.sun.grid.jgrid.Job#resume()
   */ 
  public void resume (String jobId) throws CommandFailedException {
    log.entering ("com.sun.grid.jgrid.server.JCEPHandler", "resume");
   
    Job job = (Job)jobMap.get (jobId);
   
    if (job == null) {
      log.finer ("Resume command failed for job " + jobId + ": No such job");
     
      throw new CommandFailedException (jobId, "No such job");
    }
    else if (job.getState () == Job.SUSPENDED) {
      job.resume ();

      log.fine ("Job has been resumed: " + jobId);
    }
    else {
      log.finer ("Resume command failed for job " + jobId + ": Job is not suspended");
View Full Code Here

   * @see com.sun.grid.jgrid.Job#suspend()
   */ 
  public void suspend (String jobId) throws CommandFailedException {
    log.entering ("com.sun.grid.jgrid.server.JCEPHandler", "suspend");
   
    Job job = (Job)jobMap.get (jobId);
   
    if (job == null) {
      log.finer ("Suspend command failed for job " + jobId + ": No such job");
     
      throw new CommandFailedException (jobId, "No such job");
    }
    else if (job.getState () == Job.RUNNING) {
      try {
        job.suspend ();
       
        log.fine ("Job has been suspended: " + jobId);
      }
      catch (NotInterruptableException e) {
        log.finer ("Suspend command failed for job " + jobId + ": Job cannot be interrupted");
View Full Code Here

          log.finest ("Read code: 0x" + Integer.toString (code, 16));
         
          switch (code) {
            case SUBMIT_JOB:
              Job job = null;
              String location = null;

              try {
                location = (String)din.readUTF ();
              }
              catch (IOException e) {
                logErrorOrWarn (SYSTEM_ID, "Error while reading job location for submit from client: " + e.getMessage ());
               
                break;
              }

              try {
                FileInputStream fis = new FileInputStream (location);
                JCEPInputStream ois = new JCEPInputStream (fis);
               
                job = (Job)ois.readObject ();
                job.setAnnotation (ois.getLastAnnotation ());
              }
              catch (MalformedURLException e) {
                logErrorOrWarn (SYSTEM_ID, "Unable to load class from URL for submit: " + e.getMessage ());
               
                try {
                  notifyCommandFailed (SUBMIT_JOB, NO_JOB_ID, e.getMessage ());
                }
                catch (IOException e2) {
                  logErrorOrWarn (job.getJobId (), "Error while writing submit failure message to client: " + e.getMessage ());
               
                  break;
                }

                break;
              }
              catch (IOException e) {
                logErrorOrWarn (SYSTEM_ID, "Unable to read job file for submit: " + location);
               
                try {
                  notifyCommandFailed (SUBMIT_JOB, NO_JOB_ID, e.getMessage ());
                }
                catch (IOException e2) {
                  logErrorOrWarn (job.getJobId (), "Error while writing submit failure message to client: " + e.getMessage ());
               
                  break;
                }
               
                break;
              }
              catch (ClassNotFoundException e) {
                logErrorOrWarn (SYSTEM_ID, "Unable to load job class for submit: " + e.getMessage ());
               
                try {
                  notifyCommandFailed (SUBMIT_JOB, NO_JOB_ID, e.getMessage ());
                }
                catch (IOException e2) {
                  logErrorOrWarn (job.getJobId (), "Error while writing submit failure message to client: " + e.getMessage ());
               
                  break;
                }

                break;
              }

              try {
                engine.submitJob (job);           
                registeredJobId = job.getJobId ();
              }
              catch (CommandFailedException e) {
                try {
                  notifyCommandFailed (SUBMIT_JOB, job.getJobId (), e.getMessage ());
                }
                catch (IOException e2) {
                  logErrorOrWarn (job.getJobId (), "Error while writing submit failure message to client: " + e.getMessage ());
               
                  break;
                }
              }
View Full Code Here

TOP

Related Classes of com.sun.grid.jgrid.Job

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.