Thanks to visit codestin.com
Credit goes to github.com

Skip to content

OperationFuture .get can throw a TimeoutException wrapped in an ExecutionException that doesn't get propagated out as an OperationTimeoutException #48

@jattisha

Description

@jattisha

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions