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

相關文章
相關標籤/搜索