/** 恢复作业 */ public synchronized void remove(TimerTask task) { JobWrapper wraper = (JobWrapper) jobWrapperMap.remove(task); if (wraper != null) { wraper.setCurrentStatus(JobStatus.DEAD); jobWrapperList.remove(wraper); } }
/** 取消作业 */ 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); } }
/** 清空对列 */ 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; }
/** 将对象压入队列的尾部 */ 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(); } }
/** 恢复作业 */ public synchronized void resume(TimerTask task) { JobWrapper wraper = this.getWrapper(task); if (wraper != null) { wraper.setCurrentStatus(JobStatus.WAITING); } }
/** 挂起作业 */ public synchronized void suspend(TimerTask task) { JobWrapper wraper = this.getWrapper(task); if (wraper != null) { wraper.setCurrentStatus(JobStatus.SUSPENDED); } }
/** 恢复作业 */ public synchronized void resume(Job job) { JobWrapper wraper = this.getWrapper(job); if (wraper != null) { wraper.setCurrentStatus(JobStatus.WAITING); } }