AsyncContextImpl$future字段没有并发控制
- Dominant language
- Java
- Stars
- 41.6k
- Forks
- 26.4k
- Avg merge
- 15h 13m
- Merged PRs (30d)
- 4
Description
* Dubbo version: latest
https://github.com/apache/dubbo/blob/dubbo-2.7.8/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/AsyncContextImpl.java
```java
private final AtomicBoolean started = new AtomicBoolean(false);
private CompletableFuture future;
public void start() {
if (this.started.compareAndSet(false, true)) {
this.future = new CompletableFuture<>();
}
}
public void write(Object value) {
if (isAsyncStarted() && stop()) {
if (value instanceof Throwable) {
Throwable bizExe = (Throwable) value;
future.completeExceptionally(bizExe);
} else {
future.complete(value);
}
} else {
// ignored
}
}
```
当`isAsyncStarted()`返回true时确定能保证future字段的可见性么?
Contributor guide
Assessment
This issue has not been assessed yet.