PromiseTask.isCancelled performs an unsynchronized read (#10066)

Motivation:

PromiseTask.isCancelled performs an unsynchronized read and so may trigger race-detectors. As this was just done for a small optimization which should not really make a lot of difference we should just remove it.

Modifications:

Remove unsynchronized read optimization

Result:

Fixes https://github.com/netty/netty/issues/10026.
This commit is contained in:
Norman Maurer 2020-02-28 07:06:02 +01:00 committed by GitHub
parent a304d61b26
commit c9f38f855e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -176,11 +176,6 @@ class PromiseTask<V> extends DefaultPromise<V> implements RunnableFuture<V> {
return clearTaskAfterCompletion(super.cancel(mayInterruptIfRunning), CANCELLED);
}
@Override
public final boolean isCancelled() {
return task == CANCELLED || super.isCancelled();
}
@Override
protected StringBuilder toStringBuilder() {
StringBuilder buf = super.toStringBuilder();