private ReactiveSeq<Integer> nextAsync() { AsyncSubscriber<Integer> sub = Spouts.asyncSubscriber(); new Thread(()->{ sub.awaitInitialization(); try { //not a reactive-stream so we don't know with certainty when demand signalled Thread.sleep(10); } catch (InterruptedException e) { e.printStackTrace(); } sub.onNext(1); sub.onNext(2); sub.onComplete(); }).start(); return sub.stream(); }
private ReactiveSeq<Integer> nextAsync() { AsyncSubscriber<Integer> sub = Spouts.asyncSubscriber(); new Thread(()->{ sub.awaitInitialization(); try { //not a reactive-stream so we don't know with certainty when demand signalled Thread.sleep(10); } catch (InterruptedException e) { e.printStackTrace(); } sub.onNext(1); sub.onNext(2); sub.onComplete(); }).start(); return sub.stream(); } }
private Stream<Integer> nextAsync() { AsyncSubscriber<Integer> sub = Spouts.asyncSubscriber(); new Thread(()->{ sub.awaitInitialization(); try { //not a reactive-stream so we don't know with certainty when demand signalled Thread.sleep(10); } catch (InterruptedException e) { e.printStackTrace(); } sub.onNext(1); sub.onNext(2); sub.onComplete(); }).start(); return sub.stream(); } }
private Stream<Integer> nextAsync() { AsyncSubscriber<Integer> sub = Spouts.asyncSubscriber(); new Thread(()->{ sub.awaitInitialization(); try { //not a reactive-stream so we don't know with certainty when demand signalled Thread.sleep(10); } catch (InterruptedException e) { e.printStackTrace(); } sub.onNext(1); sub.onNext(2); sub.onComplete(); }).start(); return sub.stream(); } }
private ReactiveSeq<Integer> nextAsync() { AsyncSubscriber<Integer> sub = Spouts.asyncSubscriber(); new Thread(()->{ sub.awaitInitialization(); try { //not a reactive-stream so we don't know with certainty when demand signalled Thread.sleep(10); } catch (InterruptedException e) { e.printStackTrace(); } sub.onNext(1); sub.onNext(2); sub.onComplete(); }).start(); return sub.stream(); } }
private ReactiveSeq<Integer> nextAsync() { AsyncSubscriber<Integer> sub = Spouts.asyncSubscriber(); new Thread(()->{ sub.awaitInitialization(); try { //not a reactive-stream so we don't know with certainty when demand signalled Thread.sleep(10); } catch (InterruptedException e) { e.printStackTrace(); } sub.onNext(1); sub.onNext(2); sub.onComplete(); }).start(); return sub.stream(); } }