Tabnine Logo
Duration.isZero
Code IndexAdd Tabnine to your IDE (free)

How to use
isZero
method
in
org.threeten.bp.Duration

Best Java code snippets using org.threeten.bp.Duration.isZero (Showing top 20 results out of 315)

origin: googleapis/google-cloud-java

if (!externalFuture.getAttemptSettings().getRpcTimeout().isZero()) {
 currentCallContext =
   currentCallContext.withTimeout(externalFuture.getAttemptSettings().getRpcTimeout());
origin: com.google.api/gax

/** Wraps the target observer with timing constraints. */
public <ResponseT> ResponseObserver<ResponseT> watch(
  ResponseObserver<ResponseT> innerObserver,
  @Nonnull Duration waitTimeout,
  @Nonnull Duration idleTimeout) {
 Preconditions.checkNotNull(innerObserver, "innerObserver can't be null");
 Preconditions.checkNotNull(waitTimeout, "waitTimeout can't be null");
 Preconditions.checkNotNull(idleTimeout, "idleTimeout can't be null");
 if (waitTimeout.isZero() && idleTimeout.isZero()) {
  return innerObserver;
 }
 WatchdogStream<ResponseT> stream =
   new WatchdogStream<>(innerObserver, waitTimeout, idleTimeout);
 openStreams.put(stream, PRESENT);
 return stream;
}
origin: googleapis/gax-java

/** Wraps the target observer with timing constraints. */
public <ResponseT> ResponseObserver<ResponseT> watch(
  ResponseObserver<ResponseT> innerObserver,
  @Nonnull Duration waitTimeout,
  @Nonnull Duration idleTimeout) {
 Preconditions.checkNotNull(innerObserver, "innerObserver can't be null");
 Preconditions.checkNotNull(waitTimeout, "waitTimeout can't be null");
 Preconditions.checkNotNull(idleTimeout, "idleTimeout can't be null");
 if (waitTimeout.isZero() && idleTimeout.isZero()) {
  return innerObserver;
 }
 WatchdogStream<ResponseT> stream =
   new WatchdogStream<>(innerObserver, waitTimeout, idleTimeout);
 openStreams.put(stream, PRESENT);
 return stream;
}
origin: com.google.api/gax

 @SuppressWarnings("ConstantConditions")
 @Nullable
 @Override
 public Watchdog getWatchdog() {
  Preconditions.checkState(!needsClock(), "A clock is needed");
  Preconditions.checkState(!needsCheckInterval(), "A check interval is needed");
  Preconditions.checkState(!needsExecutor(), "An executor is needed");

  // Watchdog is disabled
  if (checkInterval.isZero()) {
   return null;
  }

  Watchdog watchdog = new Watchdog(clock);
  executor.scheduleAtFixedRate(
    watchdog, checkInterval.toMillis(), checkInterval.toMillis(), TimeUnit.MILLISECONDS);

  return watchdog;
 }
}
origin: com.google.api/gax-grpc

@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);
}
origin: googleapis/gax-java

 @SuppressWarnings("ConstantConditions")
 @Nullable
 @Override
 public Watchdog getWatchdog() {
  Preconditions.checkState(!needsClock(), "A clock is needed");
  Preconditions.checkState(!needsCheckInterval(), "A check interval is needed");
  Preconditions.checkState(!needsExecutor(), "An executor is needed");

  // Watchdog is disabled
  if (checkInterval.isZero()) {
   return null;
  }

  Watchdog watchdog = new Watchdog(clock);
  executor.scheduleAtFixedRate(
    watchdog, checkInterval.toMillis(), checkInterval.toMillis(), TimeUnit.MILLISECONDS);

  return watchdog;
 }
}
origin: com.google.api/gax-httpjson

@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);
}
origin: googleapis/gax-java

@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);
}
origin: googleapis/gax-java

@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);
}
origin: com.google.api/gax

if (!idleTimeout.isZero() && waitTime >= idleTimeout.toMillis()) {
 myError = new WatchdogTimeoutException("Canceled due to idle connection", false);
if (!waitTimeout.isZero() && waitTime >= waitTimeout.toMillis()) {
 myError =
   new WatchdogTimeoutException(
origin: googleapis/gax-java

if (!idleTimeout.isZero() && waitTime >= idleTimeout.toMillis()) {
 myError = new WatchdogTimeoutException("Canceled due to idle connection", false);
if (!waitTimeout.isZero() && waitTime >= waitTimeout.toMillis()) {
 myError =
   new WatchdogTimeoutException(
origin: googleapis/gax-java

@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);
}
origin: com.google.cloud/google-cloud-bigtable

if (!externalFuture.getAttemptSettings().getRpcTimeout().isZero()) {
 currentCallContext =
   currentCallContext.withTimeout(externalFuture.getAttemptSettings().getRpcTimeout());
origin: googleapis/gax-java

 @Override
 public ApiFuture<OperationSnapshot> futureCall(RequestT request, ApiCallContext context) {
  FakeCallContext fakeCallContext = (FakeCallContext) context;
  if (fakeCallContext != null
    && fakeCallContext.getTimeout() != null
    && fakeCallContext.getTimeout().isZero()) {
   throw new DeadlineExceededException(
     "Invalid timeout of 0 s",
     null,
     FakeStatusCode.of(StatusCode.Code.DEADLINE_EXCEEDED),
     true);
  }
  OperationSnapshot response = results[index];
  if (index < results.length - 1) {
   index += 1;
  }
  return newFuture(returnStatusCode, response);
 }
};
origin: com.google.api/gax

if (!outerRetryingFuture.getAttemptSettings().getRpcTimeout().isZero()) {
 attemptContext =
   attemptContext.withStreamWaitTimeout(
origin: googleapis/gax-java

if (!outerRetryingFuture.getAttemptSettings().getRpcTimeout().isZero()) {
 attemptContext =
   attemptContext.withStreamWaitTimeout(
origin: com.google.api/gax

 @Override
 public ResponseT call() {
  ApiCallContext callContext = originalCallContext;

  try {
   Duration rpcTimeout = externalFuture.getAttemptSettings().getRpcTimeout();
   if (!rpcTimeout.isZero()) {
    callContext = callContext.withTimeout(rpcTimeout);
   }

   externalFuture.setAttemptFuture(new NonCancellableFuture<ResponseT>());
   if (externalFuture.isDone()) {
    return null;
   }

   callContext
     .getTracer()
     .attemptStarted(externalFuture.getAttemptSettings().getOverallAttemptCount());

   ApiFuture<ResponseT> internalFuture = callable.futureCall(request, callContext);
   externalFuture.setAttemptFuture(internalFuture);
  } catch (Throwable e) {
   externalFuture.setAttemptFuture(ApiFutures.<ResponseT>immediateFailedFuture(e));
  }

  return null;
 }
}
origin: googleapis/gax-java

 @Override
 public ResponseT call() {
  ApiCallContext callContext = originalCallContext;

  try {
   Duration rpcTimeout = externalFuture.getAttemptSettings().getRpcTimeout();
   if (!rpcTimeout.isZero()) {
    callContext = callContext.withTimeout(rpcTimeout);
   }

   externalFuture.setAttemptFuture(new NonCancellableFuture<ResponseT>());
   if (externalFuture.isDone()) {
    return null;
   }

   callContext
     .getTracer()
     .attemptStarted(externalFuture.getAttemptSettings().getOverallAttemptCount());

   ApiFuture<ResponseT> internalFuture = callable.futureCall(request, callContext);
   externalFuture.setAttemptFuture(internalFuture);
  } catch (Throwable e) {
   externalFuture.setAttemptFuture(ApiFutures.<ResponseT>immediateFailedFuture(e));
  }

  return null;
 }
}
origin: com.google.api/gax

if (!rpcTimeout.isZero()) {
 callContext = callContext.withTimeout(rpcTimeout);
origin: googleapis/gax-java

if (!rpcTimeout.isZero()) {
 callContext = callContext.withTimeout(rpcTimeout);
org.threeten.bpDurationisZero

Javadoc

Checks if this duration is zero length.

A Duration represents a directed distance between two points on the time-line and can therefore be positive, zero or negative. This method checks whether the length is zero.

Popular methods of Duration

  • ofMillis
    Obtains an instance of Duration from a number of milliseconds. The seconds and nanoseconds are extra
  • ofSeconds
    Obtains an instance of Duration from a number of seconds and an adjustment in nanoseconds. This meth
  • toMillis
    Converts this duration to the total length in milliseconds. If this duration is too large to fit in
  • ofMinutes
    Obtains an instance of Duration from a number of standard length minutes. The seconds are calculated
  • compareTo
    Compares this duration to the specified Duration. The comparison is based on the total length of the
  • getSeconds
    Gets the number of seconds in this duration. The length of the duration is stored using two fields -
  • between
    Obtains an instance of Duration representing the duration between two instants. Obtains a Duration
  • getNano
    Gets the number of nanoseconds within the second in this duration. The length of the duration is sto
  • isNegative
    Checks if this duration is negative, excluding zero. A Duration represents a directed distance betwe
  • toNanos
    Converts this duration to the total length in nanoseconds expressed as a long. If this duration is
  • ofHours
    Obtains an instance of Duration from a number of standard length hours. The seconds are calculated b
  • ofNanos
    Obtains an instance of Duration from a number of nanoseconds. The seconds and nanoseconds are extrac
  • ofHours,
  • ofNanos,
  • equals,
  • of,
  • ofDays,
  • plus,
  • toMinutes,
  • <init>,
  • create

Popular in Java

  • Parsing JSON documents to java classes using gson
  • setScale (BigDecimal)
  • startActivity (Activity)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • Map (java.util)
    A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si
  • TimerTask (java.util)
    The TimerTask class represents a task to run at a specified time. The task may be run once or repeat
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now