You can implement this at your client layer. This will hold up your application thread as opposed to driver’s thread. Pseudo code:
public void executeWithRetry(Statement statement) throws TimeoutException {
final ResultSetFuture resultSetFuture = session.executeAsync(statement);
try {
return resultSetFuture.getUninterruptibly(timeOutMillis, TimeUnit.MILLISECONDS);
} catch (final TimeoutException e) {
if (numRetry < maxRetry) {
long waitTimeMillis = getWaitTime(numRetry++);
Uninterruptibles.sleepUninterruptibly(waitTimeMillis, TimeUnit.MILLISECONDS);
executeWithRetry(statement);
}
throw e;
}
}
If you are willing to implement Session interface, you can also have this logic in your session implementation.