This week's giveaway is in the OCPJP forum. We're giving away four copies of Practice Tests for OCP Java 17 Certification Exam (1Z0-829) and have Paul Anilprem on-line! See this thread for details.
I am working on some legacy code that spins off several threads and waits until they all finish or exceed a time limit before proceeding forward. IT is written in Java 1.2 style syncing on an object etc.
Is there any easier way to do this, say using an Executor or ExecutorService? I have reviewed these classes but I cannot figure out how to accomplish the same thing.
With ExecutorService, you can just use the invokeAll() method - the one with three parameters, which allows you to specify a timeout. The method won't return until each task either completes or times out.
"I'm not back." - Bill Harding, Twister
He loves you so much! And I'm baking the cake! I'm going to put this tiny ad in the cake:
Free, earth friendly heat - from the CodeRanch trailboss