Fix a bug where DefaultPromise.setUncancellable() returns a wrong value
- Fixes #2220 - again - Missing negation
This commit is contained in:
parent
7e0e4c6325
commit
0e71da3082
@ -461,14 +461,14 @@ public class DefaultPromise<V> extends AbstractFuture<V> implements Promise<V> {
|
|||||||
public boolean setUncancellable() {
|
public boolean setUncancellable() {
|
||||||
Object result = this.result;
|
Object result = this.result;
|
||||||
if (isDone0(result)) {
|
if (isDone0(result)) {
|
||||||
return isCancelled0(result);
|
return !isCancelled0(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
// Allow only once.
|
// Allow only once.
|
||||||
result = this.result;
|
result = this.result;
|
||||||
if (isDone0(result)) {
|
if (isDone0(result)) {
|
||||||
return isCancelled0(result);
|
return !isCancelled0(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.result = UNCANCELLABLE;
|
this.result = UNCANCELLABLE;
|
||||||
|
Loading…
Reference in New Issue
Block a user