我发现我做不到
ExecutorService executorService = Executors.newSingleThreadExecutor()
Callable<String> stringCallable = {
"hello world"
} as Callable<String>
Future<String> f = executorService.submit(stringCallable)
println f.get()
executorService.shutdown()
输出为:
null
但是当我直接跑步时:
println stringCallable.call()
输出为:
"hello world"