When calling .get(duration, unit) for an OperationTimeout, there's a possibility that the underlying operation can timeout, resulting in a CheckedOperationTimeoutException wrapped in an ExecutionException. However, when the MemecachedClient implementation receives this exception for most of the methods that operate on these behaviors, it ends up simply propagating this up as a RuntimeException, rather than actually representing that the request timed out. For these, the proposal is to add an additional check to this code for:
...
} catch (ExecutionException e) {
if (e.getCause() instanceof CancellationException) {
throw (CancellationException) e.getCause();
} else if (e.getCause() instanceof TimeoutException) {
throw new OperationTimeoutException("Timeout waiting for value", e);
} else {
throw new RuntimeException("Exception waiting for value", e);
}
....
I've also created a PR for this, and will attach it to this issue.