-
-
Save ursimon/dfa88a8144098f685aedc20b9c4f06f5 to your computer and use it in GitHub Desktop.
Revisions
-
antslava created this gist
Feb 15, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,52 @@ package com.antmobile.java; import rx.Observable; import rx.Subscriber; import rx.schedulers.Schedulers; public class FirstTempClass { public static void main(String[] args) { final Observable<Long> observable = Observable.create(new Observable.OnSubscribe<Long>() { public void call(Subscriber<? super Long> subscriber) { subscriber.onNext(System.nanoTime()); } }) .subscribeOn(Schedulers.io()) .observeOn(Schedulers.io()) .share(); // First observable.subscribe(new Subscriber<Long>() { public void onCompleted() { System.out.println(""); } public void onError(Throwable e) { System.out.println(); } public void onNext(Long aLong) { System.out.println("first:= " + aLong); } }); // Second observable.subscribe(new Subscriber<Long>() { public void onCompleted() { System.out.println(); } public void onError(Throwable e) { System.out.println(); } public void onNext(Long aLong) { System.out.println("second:= " + aLong); } }); while (true) { } } }