List of usage examples for org.springframework.scheduling.config ScheduledTask cancel
public void cancel()
From source file:org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor.java
@Override public void postProcessBeforeDestruction(Object bean, String beanName) { Set<ScheduledTask> tasks; synchronized (this.scheduledTasks) { tasks = this.scheduledTasks.remove(bean); }/* w ww. j av a 2 s . c om*/ if (tasks != null) { for (ScheduledTask task : tasks) { task.cancel(); } } }
From source file:org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor.java
@Override public void destroy() { synchronized (this.scheduledTasks) { Collection<Set<ScheduledTask>> allTasks = this.scheduledTasks.values(); for (Set<ScheduledTask> tasks : allTasks) { for (ScheduledTask task : tasks) { task.cancel(); }//from ww w.j a v a 2 s . com } this.scheduledTasks.clear(); } this.registrar.destroy(); }