Skip to content

Instantly share code, notes, and snippets.

@KowalczykBartek
Created January 31, 2017 16:55
Show Gist options
  • Save KowalczykBartek/dd7b0ad6055422f42ac57969a6bd6d07 to your computer and use it in GitHub Desktop.
Save KowalczykBartek/dd7b0ad6055422f42ac57969a6bd6d07 to your computer and use it in GitHub Desktop.
Observable.just(1, 2, 3, 4, 5)//
.map(c -> {
System.out.println("1 " + Thread.currentThread().getName());
return c;
})//
.flatMap(a -> {
return Observable.just(1) //
.observeOn(Schedulers.io())//
.map(b -> b)//
.map(c -> {
try
{
Thread.sleep(10000);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
System.out.println("2 " + Thread.currentThread().getName());
return c;
});
},1)//
.map(c -> {
System.out.println("3 " + Thread.currentThread().getName());
return c;
}) //
.subscribe();
while (true)
{
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment