Skip to content

Commit 10a4057

Browse files
ingenthrMichael Nitschinger
authored andcommitted
SPY-107: Ensure state of timedout is known across IO and user threads.
After seeing this in a log, I re-thought through the series of events here. This flag on the op is known by user threads and the IO thread. Thus it is modified in these two different ways: * operation is created and enqueued * OperationFuture is returned * .get() is called on OF **timed out** * operation is removed from input queue * elapsed time is checked **timed out** Change-Id: I879f9b6459aa2fce1ddd97c5803da8c5392453a5 Reviewed-on: http://review.couchbase.org/23798 Reviewed-by: Michael Nitschinger <[email protected]> Reviewed-by: Matt Ingenthron <[email protected]> Tested-by: Matt Ingenthron <[email protected]>
1 parent b25e989 commit 10a4057

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/main/java/net/spy/memcached/protocol/BaseOperationImpl.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public abstract class BaseOperationImpl extends SpyObject implements Operation {
5757
private OperationException exception = null;
5858
protected OperationCallback callback = null;
5959
private volatile MemcachedNode handlingNode = null;
60-
private boolean timedout;
60+
private volatile boolean timedout;
6161
private long creationTime;
6262
private boolean timedOutUnsent = false;
6363
protected Collection<MemcachedNode> notMyVbucketNodes =
@@ -208,14 +208,10 @@ public synchronized boolean isTimedOut(long ttlMillis) {
208208
timedout = true;
209209
callback.receivedStatus(TIMED_OUT);
210210
callback.complete();
211-
} else {
211+
} // else
212212
// timedout would be false, but we cannot allow you to untimeout an
213-
// operation
214-
if (timedout) {
215-
throw new IllegalArgumentException("Operation has already timed out;"
216-
+ " ttl specified would allow it to be valid.");
217-
}
218-
}
213+
// operation. This can happen when the latch timeout is shorter than the
214+
// default operation timeout.
219215
return timedout;
220216
}
221217

0 commit comments

Comments
 (0)