我写了这段代码
val myEc = new ExecutionContext {
val tp = Executors.newFixedThreadPool(2)
def execute(r: Runnable) { tp.submit(r) }
def reportFailure(t: Throwable) { println("ho ha ha ... something broke!") }
}
val f : Future[Int] = Future(throw new Exception("123"))(myEc)
Await.result(f, Duration.Inf)
该程序不打印“ho ha ha”...那么reportFailure的目的是什么呢?当未来失败时,它不应该被召唤吗?