Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 11 for tryAcquire (0.18 sec)

  1. guava-tests/test/com/google/common/util/concurrent/RateLimiterTest.java

        assertTrue(limiter.tryAcquire(0, SECONDS));
        assertFalse(limiter.tryAcquire(0, SECONDS));
        assertFalse(limiter.tryAcquire(0, SECONDS));
        stopwatch.sleepMillis(100);
        assertFalse(limiter.tryAcquire(0, SECONDS));
      }
    
      public void testTryAcquire_someWaitAllowed() {
        RateLimiter limiter = RateLimiter.create(5.0, stopwatch);
        assertTrue(limiter.tryAcquire(0, SECONDS));
    Java
    - Registered: Fri Apr 12 12:43:09 GMT 2024
    - Last Modified: Wed Sep 06 17:04:31 GMT 2023
    - 21.6K bytes
    - Viewed (0)
  2. android/guava/src/com/google/common/util/concurrent/RateLimiter.java

       */
      @SuppressWarnings("GoodTime") // should accept a java.time.Duration
      public boolean tryAcquire(long timeout, TimeUnit unit) {
        return tryAcquire(1, timeout, unit);
      }
    
      /**
       * Acquires permits from this {@link RateLimiter} if it can be acquired immediately without delay.
       *
       * <p>This method is equivalent to {@code tryAcquire(permits, 0, anyUnit)}.
       *
       * @param permits the number of permits to acquire
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Tue Apr 04 09:45:04 GMT 2023
    - 18.2K bytes
    - Viewed (0)
  3. android/guava-tests/test/com/google/common/util/concurrent/RateLimiterTest.java

        assertTrue(limiter.tryAcquire(0, SECONDS));
        assertFalse(limiter.tryAcquire(0, SECONDS));
        assertFalse(limiter.tryAcquire(0, SECONDS));
        stopwatch.sleepMillis(100);
        assertFalse(limiter.tryAcquire(0, SECONDS));
      }
    
      public void testTryAcquire_someWaitAllowed() {
        RateLimiter limiter = RateLimiter.create(5.0, stopwatch);
        assertTrue(limiter.tryAcquire(0, SECONDS));
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Wed Sep 06 17:04:31 GMT 2023
    - 21.6K bytes
    - Viewed (0)
  4. android/guava/src/com/google/common/util/concurrent/Uninterruptibles.java

            }
          }
        } finally {
          if (interrupted) {
            Thread.currentThread().interrupt();
          }
        }
      }
    
      /**
       * Invokes {@code semaphore.}{@link Semaphore#tryAcquire(int, long, TimeUnit) tryAcquire(1,
       * timeout, unit)} uninterruptibly.
       *
       * @since 18.0
       */
      @J2ktIncompatible
      @GwtIncompatible // concurrency
      @SuppressWarnings("GoodTime") // should accept a java.time.Duration
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Tue Apr 04 09:45:04 GMT 2023
    - 14.4K bytes
    - Viewed (0)
  5. guava-tests/test/com/google/common/util/concurrent/UninterruptiblesTest.java

        assertInterrupted();
      }
    
      public void testSleepMultiInterrupt() {
        repeatedlyInterruptTestThread(10, tearDownStack);
        sleepSuccessfully(100);
        assertInterrupted();
      }
    
      // Semaphore.tryAcquire() tests
      public void testTryAcquireWithNoWait() {
        Stopwatch stopwatch = Stopwatch.createStarted();
        Semaphore semaphore = new Semaphore(99);
        assertTrue(tryAcquireUninterruptibly(semaphore, 0, MILLISECONDS));
    Java
    - Registered: Fri Apr 12 12:43:09 GMT 2024
    - Last Modified: Wed Feb 09 22:57:07 GMT 2022
    - 31.7K bytes
    - Viewed (0)
  6. android/guava-tests/test/com/google/common/util/concurrent/UninterruptiblesTest.java

        assertInterrupted();
      }
    
      public void testSleepMultiInterrupt() {
        repeatedlyInterruptTestThread(10, tearDownStack);
        sleepSuccessfully(100);
        assertInterrupted();
      }
    
      // Semaphore.tryAcquire() tests
      public void testTryAcquireWithNoWait() {
        Stopwatch stopwatch = Stopwatch.createStarted();
        Semaphore semaphore = new Semaphore(99);
        assertTrue(tryAcquireUninterruptibly(semaphore, 0, MILLISECONDS));
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Wed Feb 09 22:57:07 GMT 2022
    - 30.9K bytes
    - Viewed (0)
  7. android/guava-tests/test/com/google/common/base/FinalizableReferenceQueueClassLoaderUnloadingTest.java

        Field sepFrqUserFinalizedF = sepFrqUserC.getField("finalized");
        Semaphore finalizeCount = (Semaphore) sepFrqUserFinalizedF.get(null);
        boolean finalized = finalizeCount.tryAcquire(5, TimeUnit.SECONDS);
        assertTrue(finalized);
    
        Field sepFrqUserFrqF = sepFrqUserC.getField("frq");
        Closeable frq = (Closeable) sepFrqUserFrqF.get(null);
        frq.close();
    
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Tue Feb 16 03:24:50 GMT 2021
    - 13.3K bytes
    - Viewed (0)
  8. android/guava/src/com/google/common/util/concurrent/SmoothRateLimiter.java

       * This has important consequences: it means that the RateLimiter doesn't remember the time of the
       * _last_ request, but it remembers the (expected) time of the _next_ request. This also enables
       * us to tell immediately (see tryAcquire(timeout)) whether a particular timeout is enough to get
       * us to the point of the next scheduling time, since we always maintain that. And what we mean by
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Tue Apr 04 09:45:04 GMT 2023
    - 19.3K bytes
    - Viewed (0)
  9. guava-tests/test/com/google/common/base/FinalizableReferenceQueueClassLoaderUnloadingTest.java

        Field sepFrqUserFinalizedF = sepFrqUserC.getField("finalized");
        Semaphore finalizeCount = (Semaphore) sepFrqUserFinalizedF.get(null);
        boolean finalized = finalizeCount.tryAcquire(5, TimeUnit.SECONDS);
        assertTrue(finalized);
    
        Field sepFrqUserFrqF = sepFrqUserC.getField("frq");
        Closeable frq = (Closeable) sepFrqUserFrqF.get(null);
        frq.close();
    
    Java
    - Registered: Fri Apr 19 12:43:09 GMT 2024
    - Last Modified: Tue Feb 16 03:24:50 GMT 2021
    - 13.3K bytes
    - Viewed (0)
  10. guava-tests/test/com/google/common/util/concurrent/JSR166TestCase.java

        } catch (Throwable t) {
          threadUnexpectedException(t);
        }
      }
    
      public void await(Semaphore semaphore) {
        try {
          assertTrue(semaphore.tryAcquire(LONG_DELAY_MS, MILLISECONDS));
        } catch (Throwable t) {
          threadUnexpectedException(t);
        }
      }
    
      //     /**
      //      * Spin-waits up to LONG_DELAY_MS until flag becomes true.
      //      */
    Java
    - Registered: Fri Apr 12 12:43:09 GMT 2024
    - Last Modified: Thu Feb 22 17:15:24 GMT 2024
    - 37.7K bytes
    - Viewed (0)
Back to top