I have a list of objects that has to be shared among multiple threads.
For example, I have a 5 discrete objects and a pool of 20 threads. At first 5 of 20 threads will start working, leaving the other threads in WAIT state. 5 threads will utilize each of 5 objects at a same time.
If any of the thread is completed it should release the object so that the 6th thread can start working.
For parallel processing of threads I think I can use Executor pool. But how to share the list of objects among threads ?