Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
1 vote
0 answers
107 views

parallelStream() seems to be deadlocking when called from static{} block [duplicate]

I have a strange deadlock that only seems to happen outside of main(). static { init(); } private static final void init() { ForkJoinPool forkJoinPool = null; ...
jordan t's user avatar
  • 156
1 vote
0 answers
51 views

Why parallel stream is hanging at static initialization phase [duplicate]

I'm preparing for OCP and have some question that really don't understand with parallel streams. Here is my code: public class Test { static long n = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) ...
Alexander Smirnov's user avatar
2 votes
1 answer
1k views

Deadlock happens if I use lambda in parallel stream but it doesn't happen if I use anonymous class instead? [duplicate]

The following code leads to deadlock(on my pc): public class Test { static { final int SUM = IntStream.range(0, 100) .parallel() .reduce((n, m) -> n + m)...
gstackoverflow's user avatar