Ejemplo n.º 1
0
    synchronized boolean isActive() {
      if (done) return false;
      if (!JobStatus.REQUIRED.equals(status)) return false;
      if (sleeping) {
        long delay = startingTime - System.currentTimeMillis();
        return delay < TeslaLimits.getJobWaitForDelayedTimeout();
      }

      return true;
    }
Ejemplo n.º 2
0
 public void scheduled(IJobChangeEvent event) {
   if (!state) {
     return;
   }
   JobInfo jobInfo = getOrCreateJobInfo(event.getJob());
   jobInfo.scheduled(event.getDelay());
   if (JobStatus.REQUIRED.equals(jobInfo.status)) {
     if (event.getJob().belongsTo(TeslaSWTAccess.getDecoratorManagerFamily())) {
       JobsManager.getInstance().nulifyTime(event.getJob());
     }
     if (jobInfo.rescheduleCounter < TeslaLimits.getJobNullifyRescheduleMaxValue()) {
       JobsManager.getInstance().nulifyTime(event.getJob());
     }
   }
 }
Ejemplo n.º 3
0
 public void enable() {
   this.state = true;
   this.needDisable = false;
   // Add all current jobs to wait queue
   Job[] find = Job.getJobManager().find(null);
   for (Job job : find) {
     if ((job instanceof UIJob && job.getState() != Job.SLEEPING)
         || job.belongsTo(getFamilyAutoBuild())
         || job.isUser()) {
       JobStatus status = calcJobStatus(job, (long) 0);
       if (JobStatus.REQUIRED.equals(status)) {
         if (job.belongsTo(TeslaSWTAccess.getDecoratorManagerFamily())) {
           JobsManager.getInstance().nulifyTime(job);
         }
         JobInfo jobInfo = getOrCreateJobInfo(job);
         if (jobInfo.rescheduleCounter < TeslaLimits.getJobNullifyRescheduleMaxValue()) {
           JobsManager.getInstance().nulifyTime(job);
         }
       }
     }
   }
 }