There's more...

You can test two interesting variants of this example:

  • If you comment the following line in the Handler class and execute the program, you will see a lot of messages written in the console. The ForkJoinPool class tries to start a worker thread to execute the task and, as it can't because they always throw an exception, it tries it over and over again:
        System.exit(-1); 
  • Something like that occurs if you change the third parameter (the exception handler) of the ForkJoinPool class constructor for the null value. In this case, you will see how the JVM writes the exceptions in the console.
  • Take this into account when you implement your own worker threads that could throw exceptions.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.14.147.123