We have a Java application to connect to OPC server, if it fail to connect to OPC server it will retry 5 times.
You can make good use of Failsafe to fulfill this requirement.
Failsafe is a lightweight, zero-dependency library for handling failures. It was designed to be as easy to use as possible, with a concise API for handling everyday use cases and the flexibility to handle everything else.
If I catch ConnectionException, it will do retry, the retry policy is as bellows:
- it will delay 2 seconds between retries
- it will retry 5 times at most