Beispiel #1
0
bool Scheduler::addJob(Job* job)
{
   bool successful = false;
   WorkQueue* jobQue;
   uint jobPriority = job->getPriority();
   uint jobID = job->getJobID();

   if((job)&&(jobPriority <= maxPriority+1))
   {
      //make sure that the Job ID is unique
      jobQue = priorityList.first();
      while(jobQue)
      {
         //if job already exists with same ID return false
         if(jobQue->containsJobID(jobID))
            return successful;                 //successful is false here
         jobQue = priorityList.next();
      }

      //no job found with the same job ID
      //get WorkQueue for priority of job
      jobQue = priorityList.at(jobPriority);
      if(jobQue)
         successful = jobQue->addJob(job);
   }
   return successful;
}
Beispiel #2
0
QString Scheduler::getJobName(uint jobID)
{
   //search for WorkQueue containing Job with jobID
   Job* tempJob;
   WorkQueue* tempQue = priorityList.first();
   while(tempQue)
   {
      tempJob = tempQue->getJob(jobID);
      if(tempJob)
      {
         //found Job containin jobID (getting pointer removes job from list so have to put it back)
         tempQue->addJob(tempJob);
         return (tempJob->getJobName());
      }
      tempQue = priorityList.next();
   }
   //did not find Job with jobID
   return (QString("No Job With Matching ID"));
}