When an exception is thrown inside one of the child threads, you could call a method like listener. SetLaunchNewThread(false) from the child thread which will change the value of your boolean flag in the parent thread. On a side note, calling AnotherClass.run() does not start a new thread but only call the run method from AnotherClass within the same thread.
Use new Thread(new AnotherClass()).start() instead.
Yeah, I know, the code above is just a... I would say pseudocode. And what is more, I don't want the main thread to wait for other threads. It has to launch 10 "child" threads, and if no exception occures in these, be able to launch next 10 threads.
– cichy202 Nov 11 at 15:54 the main thread won't have to wait. It will keep creating threads unless the value of launchNewThread gets changed by one of the child thread via the listener. – laguille Nov 11 at 16:04.
You should do it yourself - catch the exception and pass it somehow into the launching thread. Also, there is Future concept, which does it already. You should launch your threads as futures and check isDone(), and catch ExecutionException from get(), this exception will be thrown if a future's task thrown an exception.
1 for referencing the Future – bpgergo Nov 11 at 15:45.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.