This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

partial results

By: a guest on May 29th, 2014  |  syntax: Scala  |  size: 0.46 KB  |  views: 302  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. //using http://rxscala.github.io/  0.18.3
  2.     val five = Observable.interval(5000 millis).take(1)
  3.     val jdbc = Observable[String](subscriber => {
  4.       val rs = conn.prepareStatement("select name from persons").executeQuery()
  5.       while (rs.next() && !subscriber.isUnsubscribed) {
  6.         subscriber.onNext(rs.getString("name"))
  7.       }
  8.       subscriber.onCompleted()
  9.     })
  10.     val max = jdbc.takeUntil(five)
  11.     println(max.toBlockingObservable.toList)
clone this paste RAW Paste Data