Fix a bug where DefaultPromise.setUncancellable() returns a wrong value

- Fixes #2220 - again
- Missing negation
This commit is contained in:
Trustin Lee 2014-02-10 11:47:54 -08:00
parent 7e0e4c6325
commit 0e71da3082

View File

@ -461,14 +461,14 @@ public class DefaultPromise<V> extends AbstractFuture<V> implements Promise<V> {
public boolean setUncancellable() {
Object result = this.result;
if (isDone0(result)) {
return isCancelled0(result);
return !isCancelled0(result);
}
synchronized (this) {
// Allow only once.
result = this.result;
if (isDone0(result)) {
return isCancelled0(result);
return !isCancelled0(result);
}
this.result = UNCANCELLABLE;