Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 12 for tryAcquire (0.23 sec)

  1. 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 Apr 26 12:43:10 GMT 2024
    - Last Modified: Wed Sep 06 17:04:31 GMT 2023
    - 21.6K bytes
    - Viewed (0)
  2. 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)
  3. 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)
  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 Apr 26 12:43:10 GMT 2024
    - Last Modified: Wed Feb 09 22:57:07 GMT 2022
    - 30.9K bytes
    - Viewed (0)
  7. 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)
  8. 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 Apr 26 12:43:10 GMT 2024
    - Last Modified: Tue Feb 16 03:24:50 GMT 2021
    - 13.3K bytes
    - Viewed (0)
  9. src/main/java/jcifs/smb/SmbTransportImpl.java

                    }
                    if ( ( next == null || chain.allowChain(next) ) && totalSize + size < maxSize && this.credits.tryAcquire(cost) ) {
                        totalSize += size;
                        last = chain;
                        chain = next;
                    }
                    else if ( last == null && totalSize + size > maxSize ) {
    Java
    - Registered: Sun Apr 28 00:10:09 GMT 2024
    - Last Modified: Wed Jan 18 23:47:00 GMT 2023
    - 67K bytes
    - Viewed (0)
  10. 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)
Back to top