Guard concurrent access to _outbound
This commit is contained in:
parent
cb3fd44529
commit
85c106b6ca
|
@ -105,17 +105,23 @@ public class Actor implements Executor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void _injectOutbound(Long handle, Ref peer) {
|
void _injectOutbound(Long handle, Ref peer) {
|
||||||
|
synchronized (_outbound) {
|
||||||
_outbound.put(handle, peer);
|
_outbound.put(handle, peer);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Ref _lookupOutbound(Long handle) {
|
|
||||||
return _outbound.get(handle);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Ref _extractOutbound(Long handle) {
|
Ref _lookupOutbound(Long handle) {
|
||||||
|
synchronized (_outbound) {
|
||||||
|
return _outbound.get(handle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Ref _extractOutbound(Long handle) {
|
||||||
|
synchronized (_outbound) {
|
||||||
return _outbound.remove(handle);
|
return _outbound.remove(handle);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return super.toString() + "(" + this._name + ")";
|
return super.toString() + "(" + this._name + ")";
|
||||||
|
@ -168,7 +174,11 @@ public class Actor implements Executor {
|
||||||
} else {
|
} else {
|
||||||
log().log(Level.SEVERE, "Actor terminated with error", reason);
|
log().log(Level.SEVERE, "Actor terminated with error", reason);
|
||||||
}
|
}
|
||||||
Turn._forActor(this, t -> _outbound.forEach(t::_retract_));
|
Turn._forActor(this, t -> {
|
||||||
|
synchronized(_outbound) {
|
||||||
|
_outbound.forEach(t::_retract_);
|
||||||
|
}
|
||||||
|
});
|
||||||
_releaseCount();
|
_releaseCount();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue