Your example makes a lot of sense. Is there a
difference between dispatchOn().partition() and
.partition().dispatchOn()?
Streams.broadcast()
.partition(5)
.dispatchOn(environment.getCachedDispatcher())
.flatMap(stream -> stream.map());
So, as
this is written, am I right in understanding that these partitioned
streams would actually be executing on the same (single)
cachedDispatcher, instead of on parallel ones?
In
your example, this:
Streams.from(ids)
.dispatchOn(Environment.sharedDispatcher())
causes
the 'outer' stream to execute asynchronously correct?
If
you removed the dispatchOn(), the 'outer' stream would run
synchronously with the main thread, but still fork its 'workers' within
the flatMap, right?
Thanks, I'm just trying to
make sure I've got it all understood correctly.
BTW:
Why prefer cachedDispatcher() over the THREAD_POOL dispatcher?