/** * Returns a copy of this duration with a positive length. * <p> * This method returns a positive duration by effectively removing the sign from any negative total length. * For example, {@code PT-1.3S} will be returned as {@code PT1.3S}. * <p> * This instance is immutable and unaffected by this method call. * * @return a {@code Duration} based on this duration with an absolute length, not null * @throws ArithmeticException if numeric overflow occurs */ public Duration abs() { return isNegative() ? negated() : this; }
/** * Returns a copy of this duration with a positive length. * <p> * This method returns a positive duration by effectively removing the sign from any negative total length. * For example, {@code PT-1.3S} will be returned as {@code PT1.3S}. * <p> * This instance is immutable and unaffected by this method call. * * @return a {@code Duration} based on this duration with an absolute length, not null * @throws ArithmeticException if numeric overflow occurs */ public Duration abs() { return isNegative() ? negated() : this; }
@Override public GrpcCallContext withTimeout(@Nullable Duration timeout) { // Default RetrySettings use 0 for RPC timeout. Treat that as disabled timeouts. if (timeout != null && (timeout.isZero() || timeout.isNegative())) { timeout = null; } // Prevent expanding timeouts if (timeout != null && this.timeout != null && this.timeout.compareTo(timeout) <= 0) { return this; } return new GrpcCallContext( this.channel, this.callOptions, timeout, this.streamWaitTimeout, this.streamIdleTimeout, this.channelAffinity, this.extraHeaders); }
@Override public GrpcCallContext withTimeout(@Nullable Duration timeout) { // Default RetrySettings use 0 for RPC timeout. Treat that as disabled timeouts. if (timeout != null && (timeout.isZero() || timeout.isNegative())) { timeout = null; } // Prevent expanding timeouts if (timeout != null && this.timeout != null && this.timeout.compareTo(timeout) <= 0) { return this; } return new GrpcCallContext( this.channel, this.callOptions, timeout, this.streamWaitTimeout, this.streamIdleTimeout, this.channelAffinity, this.extraHeaders); }
@Override public HttpJsonCallContext withTimeout(Duration timeout) { // Default RetrySettings use 0 for RPC timeout. Treat that as disabled timeouts. if (timeout != null && (timeout.isZero() || timeout.isNegative())) { timeout = null; } // Prevent expanding deadlines if (timeout != null && this.timeout != null && this.timeout.compareTo(timeout) <= 0) { return this; } return new HttpJsonCallContext( this.channel, timeout, this.deadline, this.credentials, this.extraHeaders, this.tracer); }
@Override public HttpJsonCallContext withTimeout(Duration timeout) { // Default RetrySettings use 0 for RPC timeout. Treat that as disabled timeouts. if (timeout != null && (timeout.isZero() || timeout.isNegative())) { timeout = null; } // Prevent expanding deadlines if (timeout != null && this.timeout != null && this.timeout.compareTo(timeout) <= 0) { return this; } return new HttpJsonCallContext( this.channel, timeout, this.deadline, this.credentials, this.extraHeaders, this.tracer); }
Jdk8Methods.requireNonNull(baseClock, "baseClock"); Jdk8Methods.requireNonNull(tickDuration, "tickDuration"); if (tickDuration.isNegative()) { throw new IllegalArgumentException("Tick duration must not be negative");
Jdk8Methods.requireNonNull(baseClock, "baseClock"); Jdk8Methods.requireNonNull(tickDuration, "tickDuration"); if (tickDuration.isNegative()) { throw new IllegalArgumentException("Tick duration must not be negative");
@Override public FakeCallContext withTimeout(Duration timeout) { // Default RetrySettings use 0 for RPC timeout. Treat that as disabled timeouts. if (timeout != null && (timeout.isZero() || timeout.isNegative())) { timeout = null; } // Prevent expanding timeouts if (timeout != null && this.timeout != null && this.timeout.compareTo(timeout) <= 0) { return this; } return new FakeCallContext( this.credentials, this.channel, timeout, this.streamWaitTimeout, this.streamIdleTimeout, this.extraHeaders, this.tracer); }