File tree Expand file tree Collapse file tree 1 file changed +1
-4
lines changed
language-adaptors/rxjava-scala/src/examples/scala/rx/lang/scala/examples Expand file tree Collapse file tree 1 file changed +1
-4
lines changed Original file line number Diff line number Diff line change @@ -817,10 +817,8 @@ class RxScalaDemo extends JUnitSuite {
817817 @ Test def createExampleWithBackpressure () {
818818 val o = Observable {
819819 subscriber : Subscriber [String ] => {
820- val worker = IOScheduler ().createWorker
821820 var emitted = 0
822821 subscriber.setProducer(n => {
823- worker.schedule {
824822 val intN = if (n >= 10 ) 10 else n.toInt
825823 (0 until intN)
826824 .takeWhile(_ => emitted < 10 && ! subscriber.isUnsubscribed)
@@ -832,10 +830,9 @@ class RxScalaDemo extends JUnitSuite {
832830 if (emitted == 10 && ! subscriber.isUnsubscribed) {
833831 subscriber.onCompleted()
834832 }
835- }
836833 })
837834 }
838- }
835+ }.subscribeOn( IOScheduler ()) // Use `subscribeOn` to make sure `Producer` will run in the same Scheduler
839836 o.observeOn(ComputationScheduler ()).subscribe(new Subscriber [String ] {
840837 override def onStart () {
841838 println(" Request a new one at the beginning" )
You can’t perform that action at this time.
0 commit comments