Hi,
import scala.async.Async.{async, await} val fiveSeccond = async { val start = new java.util.Date() await { future { Thread.sleep(5000) } } val t = new java.util.Date() s"> ${start.getSeconds} - ${t.getSeconds}" } //> fiveSeccond ::)= scala.concurrent.impl.Promise$DefaultPromise@1cb237 //| 8 Await.result(fiveSeccond, 10 second) //> res1: = > 16 - 21
No comments:
Post a Comment