play framework , reschedule the job?

http://stackoverflow.com/questions/12538170/play-framework-can-i-reschedule-the-job spa

在play framework 重定义执行计划job 对象

在上文中没有提到删除 已经进入执行队列的任务 队列

因此个人写法是 get

定义job时 保留 future对象 it

private ScheduledFuture<?> future; io

future = JobsPlugin.executor.schedule((Callable<?>) job, nextDate.getTime() - now.getTime(), TimeUnit.MILLISECONDS); im

public void cancel(){
        if(future!=null)future.cancel(false);//这样取消任务
}
next

相关文章
相关标签/搜索