I have a problem with using ExecutorService
, ideally I'm looking for a solution to sleep all threads inside of thread pool (playing with Adwords API, when pushing some ads I get rate exceeded error which I catch, and then sleep that thread, but other threads are not aware of that error and still work hitting API with rate exceeded response, which increases the waiting time until another request can be processed).
Is there any simple way to sleep all threads in the same time? I tried to find any solution, I have one in mind but I'm sure there is something similar that exist out there.
Thank you for any help and have a nice day.