Last active
January 27, 2017 14:44
Revisions
-
eamelink revised this gist
Jan 27, 2017 . 1 changed file with 6 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,13 +7,14 @@ object Test extends App { val x = Future.traverse(1 to 30){ i => Future { println("Starting #" + i) blocking { Thread.sleep(2000) } println("Done with #" + i) i } } Await.ready(x, 1 minute) } -
eamelink created this gist
Jan 27, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ import scala.concurrent._ import scala.concurrent.duration._ import scala.concurrent.ExecutionContext.Implicits.global // Experiment with and without the `blocking` call in this program! object Test extends App { val x = Future.traverse(1 to 30){ i => Future { println("Starting " + i) blocking { Thread.sleep(2000) } i } } println(Await.result(x, 1 minute)) }