【发布时间】:2016-04-27 20:33:09
【问题描述】:
我在 scala Play Framework 2.5 中使用 java ReactiveX (RxJava) 与 couchbase 进行异步通信我想知道我的 observable 运行需要多长时间?我使用下面的代码定义我的 observable。
def get(id: String) : Observable[Profile] = {
this.bucket
.async()
// can I have a start time here possibly using map?
.get(id)
.map[Profile](toProfile)
// can I have an end time here possibly using map?
}
我使用以下方式调用它
Thread.sleep(1000)
val observable = get("myID")
Thread.sleep(1000)
// measure start time here
println("observable: " + observable.toBlocking.first())
// measure end time here
Thread.sleep(1000)
我如何测量 observable 运行需要多长时间?
提前谢谢你
弗朗西斯
【问题讨论】:
标签: java scala rx-java reactive-programming reactivex