How many times do you call 'c1.await()'
what count are your CyclicBarriers constructed
what about the size of your ThreadPool
Stephan van Hulst wrote:Timeouts are not in general a correct way to deal with deadlocks . You must always try to make sure that there's a possibility for the application to get through blocking calls by itself. Timeouts are only intended to cancel blocking operations that you don't have control over, such as when waiting for user input or network communication, or a call to a plugin to return.
Tyoma Sakurakoji wrote:Your program design should be writen in such way to prevent it's possibility in the first place.
My last comment was about why coding so complex logic of fallback if CyclicBarrier is already have one leading to the same result - throwing exception on CyclibBarrier after some time and realeasing "stucked" threads.
Stephan van Hulst wrote:I missed that you likely responded in regards to Piet's code. My comments apply to so-called 'real code'. As Piet said, he is just experimenting.
Blueberry pie is best when it is firm and you can hold in your hand. Smell it. And smell this tiny ad:
Programmatically Create PDF Using Free Spire.PDF with Javahttps://coderanch.com/wiki/703735/Programmatically-Create-PDF-Free-Spire