Scala Future not Awaitable? -


i trying use scala futures implement threaded bulk network service key/value store.

roughly

import scala.concurrent._ import scala.concurrent.executioncontext.implicits.global import scala.concurrent.duration._  def bulkget(keys: list[string])   val listfut = keys.map( future{ "network request here" } )   val values = future.sequence(listfut)    await.result(values, duration(10, seconds)) 

gives me compile error

[info] compiling 1 scala source .../target/scala-2.10/classes... [error]  .... type mismatch; [error]  found   : scala.concurrent.future[list[string]] [error]  required: scala.concurrent.awaitable[scala.concurrent.future[list[string]]]  [error]     await.result(values, duration(10, seconds))                          ^ 

what doing wrong.
following docs re: how block on result
http://docs.scala-lang.org/overviews/core/futures.html

is scala.concurrent.future not definition awaitable? how coerce be?

if fix syntax in example code (by putting body of def block, , replacing future{ "network request here" } _ => future{ "network request here" }), compiles , works. problem in other part of code.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -