Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 11 for tryAcquire (0.16 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));
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Mon Oct 21 14:28:19 UTC 2024
    - 21.8K 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));
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Mon Oct 21 14:28:19 UTC 2024
    - 21.8K bytes
    - Viewed (0)
  3. 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
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Sat Oct 19 00:51:36 UTC 2024
    - 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 NEXT (but since 28.0 in the JRE flavor)
       */
      @J2ktIncompatible
      @GwtIncompatible // concurrency
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Sat Oct 19 00:51:36 UTC 2024
    - 20.1K bytes
    - Viewed (0)
  5. 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
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Sat Oct 19 00:51:36 UTC 2024
    - 21.9K bytes
    - Viewed (0)
  6. 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 28.0 (but only since 33.4.0 in the Android flavor)
       */
      @J2ktIncompatible
      @GwtIncompatible // concurrency
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Sat Oct 19 00:51:36 UTC 2024
    - 19.1K 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, SECONDS);
        assertTrue(finalized);
    
        Field sepFrqUserFrqF = sepFrqUserC.getField("frq");
        Closeable frq = (Closeable) sepFrqUserFrqF.get(null);
        frq.close();
    
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Sat Oct 19 00:26:48 UTC 2024
    - 13.3K bytes
    - Viewed (0)
  8. 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
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Tue Apr 04 09:45:04 UTC 2023
    - 19.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 ) {
    Registered: Sun Nov 03 00:10:13 UTC 2024
    - Last Modified: Wed Jan 18 23:47:00 UTC 2023
    - 67K 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.
      //      */
    Registered: Fri Nov 01 12:43:10 UTC 2024
    - Last Modified: Thu Oct 17 02:42:09 UTC 2024
    - 37.9K bytes
    - Viewed (0)
Back to top