Package uk.org.microbase.scheduler.dist.data

Examples of uk.org.microbase.scheduler.dist.data.ActiveProcess


     */

    ResponderProcessWrapper processWrapper = null;
    try
    {
      ActiveProcess process = assignJob();

      if (process == null)
      {
        logger.info("No work currently available.");
        Thread.sleep(NO_WORK_WAIT);
        return;
      }

      processWrapper = new ResponderProcessWrapper(
           clientRuntime, activeProcessDao, process);
    }
    catch(Exception e)
    {
      e.printStackTrace();
      logger.log(Level.INFO,"Either failed to obtain an item of work, "
          + "or failed to process it: " + "{0}", e.getMessage());
      return;
    }

    ActiveProcess process = processWrapper.getProcess();
    logger.log(Level.INFO, "Going to process: {0}", process.getGuid());

    //These flags prevent unnecessary tidyup work after job execution
    boolean registered = false;
//    boolean installed = false;
    try
    {
      //JobWrapper - register process (actually starts a thread to do this regularly)
      /*
       * Registers the ActiveProcess object created in the previous step
       * with Microbase distributed task list. If, by this time, there are too
       * many running instances of the responder that ActiveProcess represents,
       * then a ProcessRegistrationException will be thrown.
       */
      processWrapper.registerProcess();
      registered = true;
      //JobWrapper - install job
      processWrapper.install();
//      installed = true;
      //JobWrapper - run job
      processWrapper.runJob();
    }
    catch(ProcessRegistrationException e)
    {
      logger.log(Level.INFO, "Responder: {0} failed to start because: {1}",
          new Object[]{process.getResponder().getTaskTypeGuid(), e.getMessage()});
      //e.printStackTrace();
    }
    catch(ProcessingException e)
    {
      logger.log(Level.INFO,
          "Responder: {0} either failed to install or failed to "
          + "execute correctly", process.getResponder().getTaskTypeGuid());
      e.printStackTrace();
    }
    finally
    {
      //No need to do this with a WS.
View Full Code Here


  private ActiveProcess assignJob()
      throws DBException
  {
    //Are there any 'boot' classes to run?
    ActiveProcess process = findDemandCheckJob();
    if (process != null)
    {
      logger.log(Level.INFO,
          "Found a responder demand check process to run for: {0}",
          process.getResponder().getTaskTypeGuid());
      return process;
    }

    //Are there any compute jobs currently in demand?
    process = findComputeJob();
    if (process != null)
    {
      logger.log(Level.INFO,
          "Found a responder compute-intensive process to run for: {0}",
          process.getResponder().getTaskTypeGuid());
      return process;
    }
    else
    {
      logger.info("No work found");
View Full Code Here

          responderGuid, new Date(lastRunDateLimit)});
      //If there are no recent log entries, then we could attempt to execute
      if (log.isEmpty())
      {
        //Schedule this boot job to run
        ActiveProcess process = makeProcess(responder,
            ProcessType.RESPONDER_DEMAND_CHECK);
        return process;
      }
    }
    return null; //No outstanding boot jobs to execute
View Full Code Here

    ResponderInfo responder = chooseResponder();
    if (responder == null)
    {
      return null;
    }
    ActiveProcess process = makeProcess(
        responder, ProcessType.COMPUTATIONAL_WORK);
    return process;
  }
View Full Code Here

  private ActiveProcess makeProcess(
      ResponderInfo responder,
      ProcessType type)
  {
    ActiveProcess process = new ActiveProcess();
    process.setGuid(UidGenerator.generateUid());
    process.setHostname(clientRuntime.getNodeInfo().getHostname());
    process.setLastSeen(new Date(System.currentTimeMillis()));
    process.setResponder(responder);
    process.setType(type);
    return process;
  }
View Full Code Here

TOP

Related Classes of uk.org.microbase.scheduler.dist.data.ActiveProcess

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.