Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 38 for Sleep (0.19 sec)

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

        final int millis;
        volatile boolean completed;
    
        public SleepingRunnable(int millis) {
          this.millis = millis;
        }
    
        @Override
        public void run() {
          try {
            Thread.sleep(millis);
          } catch (InterruptedException wontHappen) {
            throw new AssertionError();
          }
          completed = true;
        }
      }
    
    Java
    - Registered: Fri Apr 12 12:43:09 GMT 2024
    - Last Modified: Wed Sep 06 17:04:31 GMT 2023
    - 9.1K bytes
    - Viewed (0)
  2. guava-testlib/test/com/google/common/testing/FakeTickerTest.java

            new Callable<@Nullable Void>() {
              @Override
              public @Nullable Void call() throws Exception {
                // adds two nanoseconds to the ticker
                ticker.advance(1L);
                Thread.sleep(10);
                ticker.advance(1L);
                return null;
              }
            });
    
        assertEquals(numberOfThreads * 2, ticker.read());
      }
    
      @GwtIncompatible // concurrency
    
    Java
    - Registered: Fri Apr 19 12:43:09 GMT 2024
    - Last Modified: Tue Feb 06 14:40:46 GMT 2024
    - 6.3K bytes
    - Viewed (0)
  3. android/guava-tests/test/com/google/common/util/concurrent/JSR166TestCase.java

        }
      }
    
      /**
       * Delays, via Thread.sleep, for the given millisecond delay, but if the sleep is shorter than
       * specified, may re-sleep or yield until time elapses.
       */
      static void delay(long millis) throws InterruptedException {
        long startTime = System.nanoTime();
        long ns = millis * 1000 * 1000;
        for (; ; ) {
          if (millis > 0L) Thread.sleep(millis);
          else // too short to sleep
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Thu Feb 22 17:15:24 GMT 2024
    - 37.2K bytes
    - Viewed (0)
  4. guava-tests/test/com/google/common/util/concurrent/UninterruptiblesTest.java

        }
      }
    
      private static void assertAtLeastTimePassed(Stopwatch stopwatch, long expectedMillis) {
        long elapsedMillis = stopwatch.elapsed(MILLISECONDS);
        /*
         * The "+ 5" below is to permit, say, sleep(10) to sleep only 9 milliseconds. We see such
         * behavior sometimes when running these tests publicly as part of Guava. "+ 5" is probably more
         * generous than it needs to be.
         */
        assertTrue(
    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)
  5. android/guava-tests/test/com/google/common/util/concurrent/UninterruptiblesTest.java

        }
      }
    
      private static void assertAtLeastTimePassed(Stopwatch stopwatch, long expectedMillis) {
        long elapsedMillis = stopwatch.elapsed(MILLISECONDS);
        /*
         * The "+ 5" below is to permit, say, sleep(10) to sleep only 9 milliseconds. We see such
         * behavior sometimes when running these tests publicly as part of Guava. "+ 5" is probably more
         * generous than it needs to be.
         */
        assertTrue(
    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)
  6. guava-tests/test/com/google/common/util/concurrent/InterruptionUtil.java

          this.everyMillis = everyMillis;
          this.interruptee = interruptee;
        }
    
        @Override
        public void run() {
          while (true) {
            try {
              Thread.sleep(everyMillis);
            } catch (InterruptedException e) {
              // ok. just stop sleeping.
            }
            if (shouldStop) {
              break;
            }
            interruptee.interrupt();
          }
        }
    
    Java
    - Registered: Fri Apr 12 12:43:09 GMT 2024
    - Last Modified: Mon Dec 04 17:37:03 GMT 2017
    - 4.4K bytes
    - Viewed (1)
  7. android/guava-testlib/test/com/google/common/testing/FakeTickerTest.java

            new Callable<@Nullable Void>() {
              @Override
              public @Nullable Void call() throws Exception {
                // adds two nanoseconds to the ticker
                ticker.advance(1L);
                Thread.sleep(10);
                ticker.advance(1L);
                return null;
              }
            });
    
        assertEquals(numberOfThreads * 2, ticker.read());
      }
    
      @GwtIncompatible // concurrency
    
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Tue Feb 06 14:40:46 GMT 2024
    - 6.4K bytes
    - Viewed (0)
  8. android/guava-tests/test/com/google/common/util/concurrent/AbstractScheduledServiceTest.java

        assertEquals(1, service.numIterations.get());
        service.stopAsync();
        service.secondBarrier.await();
        service.awaitTerminated();
        // Sleep for a while just to ensure that our task wasn't called again.
        Thread.sleep(UNIT.toMillis(3 * DELAY));
        assertEquals(1, service.numIterations.get());
      }
    
      public void testCustomScheduler_deadlock() throws InterruptedException, BrokenBarrierException {
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Wed Sep 06 17:04:31 GMT 2023
    - 22.5K bytes
    - Viewed (0)
  9. android/guava-tests/test/com/google/common/collect/QueuesTest.java

        Interrupter(Thread threadToInterrupt) {
          this.threadToInterrupt = threadToInterrupt;
        }
    
        @Override
        public void run() {
          try {
            Thread.sleep(100);
          } catch (InterruptedException e) {
            throw new AssertionError();
          } finally {
            threadToInterrupt.interrupt();
          }
        }
      }
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Wed Sep 06 17:04:31 GMT 2023
    - 12K bytes
    - Viewed (0)
  10. guava-tests/test/com/google/common/util/concurrent/AbstractScheduledServiceTest.java

        assertEquals(1, service.numIterations.get());
        service.stopAsync();
        service.secondBarrier.await();
        service.awaitTerminated();
        // Sleep for a while just to ensure that our task wasn't called again.
        Thread.sleep(UNIT.toMillis(3 * DELAY));
        assertEquals(1, service.numIterations.get());
      }
    
      public void testCustomScheduler_deadlock() throws InterruptedException, BrokenBarrierException {
    Java
    - Registered: Fri Apr 12 12:43:09 GMT 2024
    - Last Modified: Wed Sep 06 17:04:31 GMT 2023
    - 22.5K bytes
    - Viewed (0)
Back to top