java,multithreading,thread-safety,callable,atomicreference
I would associate each host with an AtomicInteger that is incremented on each RestClientException. This integer would be set to zero on a succesful call to enforce the "five consecutive times" constraint. The code would look something like this. private final ConcurrentHashMap<String, AtomicInteger> failedCallCount = new ConcurrentHashMap<>(); void call() {...
java,multithreading,atomicreference
You need to make your first and second fields private and expose those values as synchronized methods. Otherwise reading the fields directly might result in outdated or partially outdated data from BigInteger objects (non-volatile field reads are not thread safe). Then your class will be thread safe. You might try...