Skip to content

Commit

Permalink
Protect NetworkImpl#close from concurrency issues (#2203)
Browse files Browse the repository at this point in the history
* Increase thread safety of NetworkImpl

* un-volatile `id`

Co-authored-by: Sergei Egorov <bsideup@gmail.com>
  • Loading branch information
pivovarit and bsideup committed Apr 12, 2020
1 parent 3833ce4 commit cbd3220
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -97,7 +97,7 @@ protected void after() {
}

@Override
public void close() {
public synchronized void close() {
if (initialized.getAndSet(false)) {
ResourceReaper.instance().removeNetworkById(id);
}
Expand Down

0 comments on commit cbd3220

Please sign in to comment.