public void send(RequestChannel<R, V> channel, R req, Fiber target) { // send may occur from a different thread than the receive thread. // Once the message is sent there is a race. The lock prevents the receiving thread from // attempting to dispose before the variables are properly set. synchronized (lock) { final Disposable requestDispose = channel.publish(target, req, this); if (timeout != null) { final Disposable timer = target.schedule(this, timeout.time, timeout.unit); this.d = new Disposable() { public void dispose() { requestDispose.dispose(); timer.dispose(); } }; } else { d = requestDispose; } } } }
public void send(RequestChannel<R, V> channel, R req, Fiber target) { // send may occur from a different thread than the receive thread. // Once the message is sent there is a race. The lock prevents the receiving thread from // attempting to dispose before the variables are properly set. synchronized (lock) { final Disposable requestDispose = channel.publish(target, req, this); if (timeout != null) { final Disposable timer = target.schedule(this, timeout.time, timeout.unit); this.d = new Disposable() { public void dispose() { requestDispose.dispose(); timer.dispose(); } }; } else { d = requestDispose; } } } }