Created
June 11, 2014 21:01
-
-
Save tstone/30e992cb0d2aab84100e 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
class BadActor extends Actor { | |
def recieve = { | |
case Process(id: Int) => process(id) | |
} | |
private def process(id: Int) = { | |
val result = SomeService.get(id) | |
result onComplete { value => | |
sender ! value | |
} | |
} | |
} | |
class GoodActor extends Actor { | |
def receive = { | |
case Process(id: Int) = process(id).map(sender ! _) | |
} | |
def process(id: Int): Future[String] = | |
SomeService.get(id) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment