Skip to content

Instantly share code, notes, and snippets.

@zsxwing
Last active January 2, 2016 13:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zsxwing/8311369 to your computer and use it in GitHub Desktop.
Save zsxwing/8311369 to your computer and use it in GitHub Desktop.
Asnyc exmaple
import rx.lang.scala.Observable._
import rx.lang.scala.JavaConversions._
import rx.lang.scala.ImplicitFunctionConversions._
import rx.util.async.Async
import java.util.concurrent.Executors
import rx.schedulers.Schedulers
object Test extends App {
val executor = Executors.newFixedThreadPool(10)
val scheduler = Schedulers.executor(executor)
val o = Async.start({
// some blocking actions
Thread.sleep(2000)
1
}, scheduler)
println(o.toBlockingObservable().single())
executor.shutdown()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment