I am currently working on creating a small framework using the executor and completion services to concurrently execute multiple tasks at the same time. I have another thread that runs independently which monitors the completion service and polls futures every 2 seconds to check for results. When a task fails, I would like to re execute it by submitting it back. I would like to retry up to 3 times. I now need a collection that can let me store the task ID, reference of the task object and the number of retries attempted which would be an integer while keeping the task ID as the unique key. Currently I am using 2 hash maps. One for storing the ID and reference and the other for storing the ID and retry count.
Edit My question is that I need suggestions for a collection that would let me store the 3 things by keeping task ID as the unique key to retrieve the task reference and the retry count more efficiently than 2 hash maps.