« Return to Thread: future hangs

future hangs

by turicum :: Rate this Message:

Reply to Author | View in Thread

Hi everybody!

This simple application hangs at "println(s())". Apparently, the mistake is so simple that I cannot find it... what am I doing wrong? Defining getData and printing s() in the interactive scala shell works just fine. Thanks!

object Test extends Application {

    val s = future(getData("AAPL\n"))
    val t = getData("INTC\n")
    println(t) // that's fine
    println(s()) // hangs here
                                                                                             
    def getData(query: String): String = {
         query
     }
}

 « Return to Thread: future hangs