Guest User

Untitled

a guest
Jun 21st, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. import io.reactivex.Completable;
  2. import io.reactivex.schedulers.Schedulers;
  3.  
  4. public class Test {
  5. static int v = 0;
  6. public static void main(String[] args){
  7. Completable.create(e -> {v = 1; e.onComplete();})
  8. .subscribeOn(Schedulers.io())
  9. .observeOn(Schedulers.computation())
  10. .subscribe(() -> System.out.println(v));
  11. try {
  12. Thread.sleep(1000);
  13. } catch (InterruptedException e) {
  14. e.printStackTrace();
  15. }
  16. }
  17. }
Add Comment
Please, Sign In to add comment