-
-
Save jwkidd3/6d37007adf2e9876a3c2ac193e193c22 to your computer and use it in GitHub Desktop.
This file contains 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 characters
FutureTask<Integer> f = new FutureTask<Integer>(() -> { | |
Thread.sleep(2000); | |
return 21; | |
}); | |
new Thread(f).start(); | |
Observable<Integer> values = Observable.from(f); | |
Subscription subscription = values.subscribe( | |
v -> System.out.println("Received: " + v), | |
e -> System.out.println("Error: " + e), | |
() -> System.out.println("Completed") | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment