Created
December 22, 2012 08:18
-
-
Save anonymous/4358042 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
| import play.api.libs.iteratee._ | |
| object EnumeratorHang { | |
| def main(args: Array[String]) { | |
| implicit val ec = scala.concurrent.ExecutionContext.Implicits.global | |
| val enumerator = Concurrent.unicast[String] { channel => | |
| channel.push("foo") | |
| channel.push("bar") | |
| channel.end() | |
| } | |
| val future = enumerator.run(Iteratee.fold[String, String]("")( | |
| (acc, s) => { | |
| println(s) | |
| acc + " " + s | |
| })) | |
| future onSuccess { | |
| case result => | |
| println("Result: " + result) | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment