Example #1
0
 /** 恢复作业 */
 public synchronized void remove(TimerTask task) {
   JobWrapper wraper = (JobWrapper) jobWrapperMap.remove(task);
   if (wraper != null) {
     wraper.setCurrentStatus(JobStatus.DEAD);
     jobWrapperList.remove(wraper);
   }
 }
Example #2
0
 /** 取消作业 */
 public synchronized void cancel(TimerTask task) {
   JobWrapper wraper = this.getWrapper(task);
   if (wraper != null) {
     wraper.setCurrentStatus(JobStatus.DEAD);
     this.jobWrapperMap.remove(task);
     this.jobWrapperList.remove(wraper);
   }
 }
Example #3
0
  /** 清空对列 */
  public synchronized void clear() {
    Iterator itor = jobWrapperList.iterator();
    while (itor.hasNext()) {
      JobWrapper wrapper = (JobWrapper) itor.next();
      wrapper.setCurrentStatus(JobStatus.DEAD);
    }

    jobWrapperMap.clear();
    jobWrapperList.clear();
    this.newJobMayBeScheduled = false;
  }
Example #4
0
 /** 将对象压入队列的尾部 */
 public synchronized void add(JobWrapper wrapper) {
   if (!jobWrapperList.contains(wrapper)) {
     this.jobWrapperList.add(wrapper);
     wrapper.setCurrentStatus(JobStatus.WAITING);
     if (wrapper.getJob() instanceof TimerTaskJob) {
       this.jobWrapperMap.put(((TimerTaskJob) wrapper.getJob()).getTimerTask(), wrapper);
     } else {
       this.jobWrapperMap.put(wrapper.getJob(), wrapper);
     }
     this.newJobMayBeScheduled = true;
     this.resort();
   }
 }
Example #5
0
 /** 恢复作业 */
 public synchronized void resume(TimerTask task) {
   JobWrapper wraper = this.getWrapper(task);
   if (wraper != null) {
     wraper.setCurrentStatus(JobStatus.WAITING);
   }
 }
Example #6
0
 /** 挂起作业 */
 public synchronized void suspend(TimerTask task) {
   JobWrapper wraper = this.getWrapper(task);
   if (wraper != null) {
     wraper.setCurrentStatus(JobStatus.SUSPENDED);
   }
 }
Example #7
0
 /** 恢复作业 */
 public synchronized void resume(Job job) {
   JobWrapper wraper = this.getWrapper(job);
   if (wraper != null) {
     wraper.setCurrentStatus(JobStatus.WAITING);
   }
 }