Last active
October 13, 2015 00:27
-
-
Save bantonsson/4110274 to your computer and use it in GitHub Desktop.
Spotlight for Futures
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
Spotlight for Futures |
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
// Akka 2.0 | |
def square(i: Int): Future[Int] = Promise successful i * i | |
// Akka 2.1 | |
def square(i: Int): Future[Int] = Future successful i * i | |
// Akka 2.0 | |
val failedFilter = future1.filter(_ % 2 == 1).recover { | |
case m: MatchError => //When filter fails, it will have a MatchError | |
} | |
// Akka 2.1 | |
val failedFilter = future1.filter(_ % 2 == 1).recover { | |
// When filter fails, it will have a java.util.NoSuchElementException | |
case m: NoSuchElementException => | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment