Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 10 of 27 for toNanos (0.04 seconds)

  1. android/guava/src/com/google/common/util/concurrent/Uninterruptibles.java

      public static boolean awaitUninterruptibly(CountDownLatch latch, long timeout, TimeUnit unit) {
        boolean interrupted = false;
        try {
          long remainingNanos = unit.toNanos(timeout);
          long end = System.nanoTime() + remainingNanos;
    
          while (true) {
            try {
              // CountDownLatch treats negative timeouts just like zero.
    Created: Fri Apr 03 12:43:13 GMT 2026
    - Last Modified: Thu Jan 29 23:24:32 GMT 2026
    - 22.5K bytes
    - Click Count (0)
  2. mockwebserver/src/main/kotlin/mockwebserver3/MockResponse.kt

        ): Builder =
          apply {
            throttleBytesPerPeriod = bytesPerPeriod
            throttlePeriodNanos = unit.toNanos(period)
          }
    
        public fun headersDelay(
          delay: Long,
          unit: TimeUnit,
        ): Builder =
          apply {
            headersDelayNanos = unit.toNanos(delay)
          }
    
        /**
         * Set the delayed time of the response body to [delay]. This applies to the response body
    Created: Fri Apr 03 11:42:14 GMT 2026
    - Last Modified: Fri Jun 20 11:46:46 GMT 2025
    - 17.8K bytes
    - Click Count (0)
  3. android/guava-testlib/src/com/google/common/testing/GcFinalization.java

      public static void awaitDone(Future<?> future) {
        if (future.isDone()) {
          return;
        }
        long timeoutSeconds = timeoutSeconds();
        long deadline = System.nanoTime() + SECONDS.toNanos(timeoutSeconds);
        do {
          System.runFinalization();
          if (future.isDone()) {
            return;
          }
          System.gc();
          try {
            future.get(1L, SECONDS);
            return;
    Created: Fri Apr 03 12:43:13 GMT 2026
    - Last Modified: Thu Mar 12 20:19:19 GMT 2026
    - 12.3K bytes
    - Click Count (0)
  4. guava-testlib/src/com/google/common/testing/GcFinalization.java

      public static void awaitDone(Future<?> future) {
        if (future.isDone()) {
          return;
        }
        long timeoutSeconds = timeoutSeconds();
        long deadline = System.nanoTime() + SECONDS.toNanos(timeoutSeconds);
        do {
          System.runFinalization();
          if (future.isDone()) {
            return;
          }
          System.gc();
          try {
            future.get(1L, SECONDS);
            return;
    Created: Fri Apr 03 12:43:13 GMT 2026
    - Last Modified: Thu Mar 12 20:19:19 GMT 2026
    - 12.3K bytes
    - Click Count (0)
  5. okhttp-testing-support/src/main/kotlin/okhttp3/internal/concurrent/TaskFaker.kt

        override fun poll(): T = delegate.poll()
    
        override fun poll(
          timeout: Long,
          unit: TimeUnit,
        ): T? {
          return taskRunner.withLock {
            val waitUntil = nanoTime + unit.toNanos(timeout)
            while (true) {
              val result = poll()
              if (result != null) return@withLock result
              if (nanoTime >= waitUntil) return@withLock null
              val editCountBefore = editCount
    Created: Fri Apr 03 11:42:14 GMT 2026
    - Last Modified: Wed May 28 23:28:25 GMT 2025
    - 11.9K bytes
    - Click Count (0)
  6. okhttp/src/jvmTest/kotlin/okhttp3/WholeOperationTimeoutTest.kt

            .newBuilder()
            .callTimeout(Duration.ofMillis(456))
            .build()
        val call = timeoutClient.newCall(request)
        assertThat(call.timeout().timeoutNanos())
          .isEqualTo(TimeUnit.MILLISECONDS.toNanos(456))
      }
    
      @Test
      fun timeoutWritingRequest() {
        server.enqueue(MockResponse())
        val request =
          Request
            .Builder()
            .url(server.url("/"))
    Created: Fri Apr 03 11:42:14 GMT 2026
    - Last Modified: Wed Jun 18 12:28:21 GMT 2025
    - 10.6K bytes
    - Click Count (0)
  7. android/guava/src/com/google/common/util/concurrent/AbstractFutureState.java

        // NOTE: if timeout < 0, remainingNanos will be < 0 and we will fall into the while(true) loop
        // at the bottom and throw a timeoutexception.
        long timeoutNanos = unit.toNanos(timeout); // we rely on the implicit null check on unit.
        long remainingNanos = timeoutNanos;
        if (Thread.interrupted()) {
          throw new InterruptedException();
        }
    Created: Fri Apr 03 12:43:13 GMT 2026
    - Last Modified: Thu Aug 07 16:05:33 GMT 2025
    - 33.2K bytes
    - Click Count (0)
  8. guava/src/com/google/common/collect/Queues.java

         * execute Queue#drainTo is not added *on top* of waiting for the timeout (which could make
         * the timeout arbitrarily inaccurate, given a queue that is slow to drain).
         */
        long deadline = System.nanoTime() + unit.toNanos(timeout);
        int added = 0;
        while (added < numElements) {
          // we could rely solely on #poll, but #drainTo might be more efficient when there are multiple
    Created: Fri Apr 03 12:43:13 GMT 2026
    - Last Modified: Mon Feb 23 19:19:10 GMT 2026
    - 18K bytes
    - Click Count (0)
  9. guava-tests/test/com/google/common/util/concurrent/AbstractFutureBenchmarks.java

         */
        @CanIgnoreReturnValue
        @Override
        public V get(long timeout, TimeUnit unit)
            throws InterruptedException, TimeoutException, ExecutionException {
          return sync.get(unit.toNanos(timeout));
        }
    
        /*
         * Improve the documentation of when InterruptedException is thrown. Our
         * behavior matches the JDK's, but the JDK's documentation is misleading.
         */
        /**
    Created: Fri Apr 03 12:43:13 GMT 2026
    - Last Modified: Sat Mar 07 02:20:33 GMT 2026
    - 13.8K bytes
    - Click Count (0)
  10. okhttp/src/commonJvmAndroid/kotlin/okhttp3/internal/ws/RealWebSocket.kt

              minimumDeflateSize = minimumDeflateSize,
            )
          this.writerTask = WriterTask()
          if (pingIntervalMillis != 0L) {
            val pingIntervalNanos = MILLISECONDS.toNanos(pingIntervalMillis)
            taskQueue.schedule("$name ping", pingIntervalNanos) {
              writePingFrame()
              return@schedule pingIntervalNanos
            }
          }
    Created: Fri Apr 03 11:42:14 GMT 2026
    - Last Modified: Thu Jul 31 04:18:40 GMT 2025
    - 21.6K bytes
    - Click Count (0)
Back to Top