Created
March 17, 2012 02:52
-
-
Save holdenk/2054580 to your computer and use it in GitHub Desktop.
Clearly I don't understand twitter futures correctly, why doesn't this work?
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
@Test | |
def zeFutures { | |
val executor = Executors.newCachedThreadPool() | |
val esfp = FuturePool(executor) | |
val future : Future[Int]= esfp({ | |
println("bots") | |
Thread.sleep(100) | |
println("have feelings") | |
1 | |
}) | |
Assert.assertEquals(1,future.get(Duration(1000,TimeUnit.SECONDS))) | |
} |
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
[error] Test FutureBBQTest.zeFutures failed: scala.Tuple2._1$mcL$sp()J | |
[error] at com.twitter.concurrent.IVar.apply(IVar.scala:254) | |
[error] at com.twitter.util.Promise.get(Future.scala:654) | |
[error] at com.twitter.util.Future.apply(Future.scala:364) | |
[error] at com.twitter.util.Future.apply(Future.scala:359) | |
[error] at com.twitter.util.TryLike$class.get(Try.scala:49) | |
[error] at com.twitter.util.Future.get(Future.scala:339) | |
[error] at FutureBBQTest.zeFutures(FutureBBQ.scala:25) | |
[error] ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment