Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add alternative getStatus() method to OperationFuture that takes time expiration parameters #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions src/main/java/net/spy/memcached/internal/OperationFuture.java
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,32 @@ public OperationStatus getStatus() {
}
return status;
}

/**
* Get the current status of this operation.
*
* Note that the operation status may change as the operation is tried and
* potentially retried against the servers specified by the NodeLocator.
*
* The interrupted status of the current thread is cleared by this method.
* Inspect the returned OperationStatus to check whether an interruption has taken place.
*
* @param duration amount of time to wait
* @param units unit of time to wait
* @return OperationStatus
*/
public OperationStatus getStatus(long duration, TimeUnit units) {
if (status == null) {
try {
get(duration, units);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fails to compile on this line. See http://review.couchbase.org/#/c/91951/

} catch (InterruptedException e) {
status = new OperationStatus(false, "Interrupted", StatusCode.INTERRUPTED);
} catch (ExecutionException e) {
getLogger().warn("Error getting status of operation", e);
}
}
return status;
}

/**
* Set the Operation associated with this OperationFuture.
Expand Down