Skip to content

Commit

Permalink
SPY-190: Remove the no-operation isInterrupted() call. Document inter…
Browse files Browse the repository at this point in the history
…ruption policy.

Motivation
----------
Avoid confusion. Make the interruption policy more clear.

Modifications
-------------
Remove the no-operation isInterrupted() call.
Document interruption policy.

Result
------
Better understandable concurrency code.

Change-Id: Iaf63f8a246c45e9ed9ebfe9c4239043cbe9e2039
Reviewed-on: http://review.couchbase.org/58266
Reviewed-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
Tested-by: Michael Nitschinger <michael.nitschinger@couchbase.com>
  • Loading branch information
Christian Esken authored and Michael Nitschinger committed Jan 13, 2016
1 parent 41cf86b commit 905c13c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/main/java/net/spy/memcached/internal/OperationFuture.java
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ public void setCas(long inCas) {
/**
* Get the CAS for this operation.
*
* The interrupted status of the current thread is cleared by this method.
* Inspect the returned OperationStatus to check whether an interruption has taken place.
*
* @throws UnsupportedOperationException If this is for an ASCII protocol
* configured client.
* @return the CAS for this operation or null if unsuccessful.
Expand All @@ -218,7 +221,6 @@ public Long getCas() {
get();
} catch (InterruptedException e) {
status = new OperationStatus(false, "Interrupted", StatusCode.INTERRUPTED);
Thread.currentThread().isInterrupted();
} catch (ExecutionException e) {
getLogger().warn("Error getting cas of operation", e);
}
Expand All @@ -235,6 +237,9 @@ public Long getCas() {
* 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.
*
* @return OperationStatus
*/
public OperationStatus getStatus() {
Expand All @@ -243,7 +248,6 @@ public OperationStatus getStatus() {
get();
} catch (InterruptedException e) {
status = new OperationStatus(false, "Interrupted", StatusCode.INTERRUPTED);
Thread.currentThread().isInterrupted();
} catch (ExecutionException e) {
getLogger().warn("Error getting status of operation", e);
}
Expand Down

0 comments on commit 905c13c

Please sign in to comment.