/** * Sets the delegate of {@code timeout} to {@link Timeout#NONE} and resets its underlying timeout * to the default configuration. Use this to avoid unexpected sharing of timeouts between pooled * connections. */ void detachTimeout(ForwardingTimeout timeout) { Timeout oldDelegate = timeout.delegate(); timeout.setDelegate(Timeout.NONE); oldDelegate.clearDeadline(); oldDelegate.clearTimeout(); }
/** * Sets the delegate of {@code timeout} to {@link Timeout#NONE} and resets its underlying timeout * to the default configuration. Use this to avoid unexpected sharing of timeouts between pooled * connections. */ void detachTimeout(ForwardingTimeout timeout) { Timeout oldDelegate = timeout.delegate(); timeout.setDelegate(Timeout.NONE); oldDelegate.clearDeadline(); oldDelegate.clearTimeout(); }
@Test public void getAndSetDelegate() { Timeout timeout1 = new Timeout(); Timeout timeout2 = new Timeout(); ForwardingTimeout forwardingTimeout = new ForwardingTimeout(timeout1); forwardingTimeout.timeout(5, TimeUnit.SECONDS); assertThat(timeout1.timeoutNanos()).isNotEqualTo(0L); assertThat(timeout2.timeoutNanos()).isEqualTo(0L); forwardingTimeout.clearTimeout(); assertThat(timeout1.timeoutNanos()).isEqualTo(0L); assertThat(timeout2.timeoutNanos()).isEqualTo(0L); assertThat(forwardingTimeout.delegate()).isEqualTo(timeout1); assertThat(forwardingTimeout.setDelegate(timeout2)).isEqualTo(forwardingTimeout); forwardingTimeout.timeout(5, TimeUnit.SECONDS); assertThat(timeout1.timeoutNanos()).isEqualTo(0L); assertThat(timeout2.timeoutNanos()).isNotEqualTo(0L); forwardingTimeout.clearTimeout(); assertThat(timeout1.timeoutNanos()).isEqualTo(0L); assertThat(timeout2.timeoutNanos()).isEqualTo(0L); assertThat(forwardingTimeout.delegate()).isEqualTo(timeout2); } }
/** * Sets the delegate of {@code timeout} to {@link Timeout#NONE} and resets its underlying timeout * to the default configuration. Use this to avoid unexpected sharing of timeouts between pooled * connections. */ private void detachTimeout(ForwardingTimeout timeout) { Timeout oldDelegate = timeout.delegate(); timeout.setDelegate(Timeout.NONE); oldDelegate.clearDeadline(); oldDelegate.clearTimeout(); }
/** * Sets the delegate of {@code timeout} to {@link Timeout#NONE} and resets its underlying timeout * to the default configuration. Use this to avoid unexpected sharing of timeouts between pooled * connections. */ void detachTimeout(ForwardingTimeout timeout) { Timeout oldDelegate = timeout.delegate(); timeout.setDelegate(Timeout.NONE); oldDelegate.clearDeadline(); oldDelegate.clearTimeout(); }
/** * Sets the delegate of {@code timeout} to {@link Timeout#NONE} and resets its underlying timeout * to the default configuration. Use this to avoid unexpected sharing of timeouts between pooled * connections. */ private void detachTimeout(ForwardingTimeout timeout) { Timeout oldDelegate = timeout.delegate(); timeout.setDelegate(Timeout.NONE); oldDelegate.clearDeadline(); oldDelegate.clearTimeout(); }
/** * Sets the delegate of {@code timeout} to {@link Timeout#NONE} and resets its underlying timeout * to the default configuration. Use this to avoid unexpected sharing of timeouts between pooled * connections. */ void detachTimeout(ForwardingTimeout timeout) { Timeout oldDelegate = timeout.delegate(); timeout.setDelegate(Timeout.NONE); oldDelegate.clearDeadline(); oldDelegate.clearTimeout(); }
/** * Sets the delegate of {@code timeout} to {@link Timeout#NONE} and resets its underlying timeout * to the default configuration. Use this to avoid unexpected sharing of timeouts between pooled * connections. */ private void detachTimeout(ForwardingTimeout timeout) { Timeout oldDelegate = timeout.delegate(); timeout.setDelegate(Timeout.NONE); oldDelegate.clearDeadline(); oldDelegate.clearTimeout(); }