我有一个要以固定速率运行的任务。但是,我还需要每次执行后的任务结果。这是我尝试过的:
任务
class ScheduledWork implements Callable<String>
{
public String call()
{
//do the task and return the result as a String
}
}
不,我尝试使用ScheduledExecutorService
来安排它。事实证明,您不能Callable
以固定的速率安排 a,只能Runnable
这样做。
请指教。