获取异步任务完成时的时间戳

时间:2014-11-24 17:09:08

标签: java asynchronous future

如果我有以下ExecutorService来执行任务,我怎样才能让它打印完成任务的时间?我应该在future.get()之后添加getCurrentTime()吗?

Future future = executorService.submit(new Callable(){
    public Object call() throws Exception {
        System.out.println("Asynchronous Callable");
        return "I finished";
    }
});

System.out.println("Status:" + future.get());

0 个答案:

没有答案