Guard concurrent access to _outbound
This commit is contained in:
parent
cb3fd44529
commit
85c106b6ca
|
@ -105,16 +105,22 @@ public class Actor implements Executor {
|
|||
}
|
||||
}
|
||||
|
||||
public void _injectOutbound(Long handle, Ref peer) {
|
||||
_outbound.put(handle, peer);
|
||||
void _injectOutbound(Long handle, Ref peer) {
|
||||
synchronized (_outbound) {
|
||||
_outbound.put(handle, peer);
|
||||
}
|
||||
}
|
||||
|
||||
public Ref _lookupOutbound(Long handle) {
|
||||
return _outbound.get(handle);
|
||||
Ref _lookupOutbound(Long handle) {
|
||||
synchronized (_outbound) {
|
||||
return _outbound.get(handle);
|
||||
}
|
||||
}
|
||||
|
||||
public Ref _extractOutbound(Long handle) {
|
||||
return _outbound.remove(handle);
|
||||
Ref _extractOutbound(Long handle) {
|
||||
synchronized (_outbound) {
|
||||
return _outbound.remove(handle);
|
||||
}
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
|
@ -168,7 +174,11 @@ public class Actor implements Executor {
|
|||
} else {
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue