Created
January 30, 2011 22:50
-
-
Save seanparsons/803360 to your computer and use it in GitHub Desktop.
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 characters
val firstLongProcessActor = actorOf[FirstLongProcessActor].start | |
val secondLongProcessActor = actorOf[SecondLongProcessActor].start | |
val startTime = currentTimeMillis | |
val firstFuture = firstLongProcessActor !!! 1000 | |
val secondFuture = secondLongProcessActor !!! 1000 | |
Futures.awaitAll(List(firstFuture, secondFuture)) | |
val timeTaken = currentTimeMillis - startTime | |
println("Process took " + timeTaken + "ms.") | |
// Output is: | |
// 1: Sleeping for 1000ms. | |
// 2: Sleeping for 1000ms. | |
// 1: Slept for 1000ms. | |
// 2: Slept for 1000ms. | |
// Process took 1006ms. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment