Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java Parallel Streams example for challenge 1 is not really non-blocking #5

Open
TexasFred opened this issue Feb 13, 2017 · 3 comments

Comments

@TexasFred
Copy link

Hello again,

I'm studying

https://github.com/ReactiveMeetupLucerne/AsyncNonBlockingExamplesJVM/blob/master/src/main/java/challenge1/java8/Java8StreamsExample.java

This doesn't look non-blocking... There is some concurrency... but the main thread is blocked until average() returns.

Is it possible at all to write non-blocking stuff using java 8 streams?

And why do you do I/O (call price service) using the common thread pool (parallelStream() uses that per default)? Isn't the common thread pool thought for CPU bound work? You are wasting threads of th common thread pool like this...

Hmmm... what do you think?

Best regards,
Fred

@TexasFred
Copy link
Author

Using a custom thread pool for parallel streams looks ugly :-(

http://stackoverflow.com/questions/21163108/custom-thread-pool-in-java-8-parallel-stream

@TexasFred
Copy link
Author

Here some more infos regarding the common pool... https://zeroturnaround.com/rebellabs/java-parallel-streams-are-bad-for-your-health/

I hope this helps!

@Petikoch
Copy link
Member

@McPringle what do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants