I am working on a the following problem and need your suggestions and ideas
I am reading 10 values from a config file and preparing 10 connections and storing it in an array as of now. All this objects in array are runnable objects.
These 10 objects connect to 10 different server(located in different locations/country) respectively.
I am writing a code to iterate this array get the objects out of it and connect to their respective server.
I have the following scenarios.
1) If Initially the servers are down I need to keep trying to connect to that server with incremental delay ( 1 min ,next try at 2, next try 4... and so on).
2) if any server disconnects I need to keep trying to connect it with a incremental delay.
I used blocking queues and could address the 2nd issue. Whenever object disconnects i pushed the object back in the queue.
The problem I am facing is that if I keep trying for the first connection objects then the other connections in the array/queue would be waiting for their turn.
I need some kind of monitoring mechanism/thread that could address both the situations in a multithreaded environment.