use*_*138 9 java java.util.concurrent
我有一项任务,我想以固定的速度运行.但是,每次执行后我还需要任务的结果.这是我尝试过的:
任务
class ScheduledWork implements Callable<String>
{
public String call()
{
//do the task and return the result as a String
}
}
Run Code Online (Sandbox Code Playgroud)
不,我试图使用它ScheduledExecutorService来安排它.事实证明,你不能Callable以固定的速度安排,只有一个Runnable可以这样做.
请指教.
| 归档时间: |
|
| 查看次数: |
4274 次 |
| 最近记录: |