Created
March 4, 2016 22:23
-
-
Save findepi/5dffe9e251321fe0aac7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import java.util.Collections; | |
/** | |
* @author piofin <[email protected]> | |
* @since Mar 4, 2016 | |
*/ | |
public class ParallelStreamReusesCaller { | |
public static void main(String[] args) { | |
Thread main = Thread.currentThread(); | |
Collections.nCopies(1000, 0) | |
.parallelStream() | |
.forEach(i -> { | |
System.out.println("Current thread = " + Thread.currentThread()); | |
if (Thread.currentThread() == main) { | |
System.exit(0); | |
} | |
}); | |
System.out.println("Did not terminate?"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment