Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 93 for CountDownLatch (0.3 sec)

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

      // Regression test for a deadlock where a task could be stuck busy waiting for the task to
      // transition to DONE
      public void testInterruptThrows() throws Exception {
        final CountDownLatch isInterruptibleRegistered = new CountDownLatch(1);
        InterruptibleTask<@Nullable Void> task =
            new InterruptibleTask<@Nullable Void>() {
              @Override
              @Nullable Void runInterruptibly() throws Exception {
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Wed Sep 06 17:04:31 GMT 2023
    - 6.6K bytes
    - Viewed (0)
  2. android/guava-tests/test/com/google/common/util/concurrent/ListenableFutureTaskTest.java

     */
    public class ListenableFutureTaskTest extends TestCase {
    
      private ExecutorService exec;
    
      protected final CountDownLatch runLatch = new CountDownLatch(1);
      protected final CountDownLatch taskLatch = new CountDownLatch(1);
      protected final CountDownLatch listenerLatch = new CountDownLatch(1);
    
      protected volatile boolean throwException = false;
    
      protected final ListenableFutureTask<Integer> task =
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Wed Sep 06 17:04:31 GMT 2023
    - 4.7K bytes
    - Viewed (0)
  3. guava-testlib/src/com/google/common/testing/GcFinalization.java

     * period or an interrupt while waiting for the expected event will result in a {@link
     * RuntimeException}.
     *
     * <p>Here's an example that tests a {@code finalize} method:
     *
     * <pre>{@code
     * final CountDownLatch latch = new CountDownLatch(1);
     * Object x = new MyClass() {
     *   ...
     *   protected void finalize() { latch.countDown(); ... }
     * };
     * x = null;  // Hint to the JIT that x is stack-unreachable
     * GcFinalization.await(latch);
    Java
    - Registered: Fri Apr 19 12:43:09 GMT 2024
    - Last Modified: Thu Feb 22 17:40:56 GMT 2024
    - 11.6K bytes
    - Viewed (0)
  4. android/guava-tests/test/com/google/common/util/concurrent/GeneratedMonitorTest.java

      private final Timeout timeout;
      private final Outcome expectedOutcome;
      private final Monitor monitor;
      private final FlagGuard guard;
      private final CountDownLatch tearDownLatch;
      private final CountDownLatch doingCallLatch;
      private final CountDownLatch callCompletedLatch;
    
      private GeneratedMonitorTest(
          Method method,
          Scenario scenario,
          boolean fair,
          @Nullable Timeout timeout,
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Mon Apr 17 14:48:57 GMT 2023
    - 26.1K bytes
    - Viewed (0)
  5. android/guava-testlib/src/com/google/common/util/concurrent/testing/AbstractListenableFutureTest.java

        assertTrue(successLatch.await(200, MILLISECONDS));
    
        latch.countDown();
      }
    
      public void testListenersNotifiedOnError() throws Exception {
        CountDownLatch successLatch = new CountDownLatch(1);
        CountDownLatch listenerLatch = new CountDownLatch(1);
    
        ExecutorService exec = Executors.newCachedThreadPool();
    
        future.addListener(listenerLatch::countDown, exec);
    
        new Thread(
                () -> {
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Wed Sep 06 18:30:30 GMT 2023
    - 6K bytes
    - Viewed (0)
  6. android/guava-testlib/src/com/google/common/util/concurrent/testing/MockFutureListener.java

      public MockFutureListener(ListenableFuture<?> future) {
        this.countDownLatch = new CountDownLatch(1);
        this.future = future;
    
        future.addListener(this, directExecutor());
      }
    
      @Override
      public void run() {
        countDownLatch.countDown();
      }
    
      /**
       * Verify that the listener completes in a reasonable amount of time, and Asserts that the future
       * returns the expected data.
       *
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Fri May 12 18:12:42 GMT 2023
    - 3K bytes
    - Viewed (0)
  7. android/guava-tests/test/com/google/common/util/concurrent/TrustedListenableFutureTaskTest.java

      @GwtIncompatible // blocking wait
      public void testCancel_interrupted() throws Exception {
        final AtomicBoolean interruptedExceptionThrown = new AtomicBoolean();
        final CountDownLatch enterLatch = new CountDownLatch(1);
        final CountDownLatch exitLatch = new CountDownLatch(1);
        final TrustedListenableFutureTask<Integer> task =
            TrustedListenableFutureTask.create(
                new Callable<Integer>() {
                  @Override
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Tue Feb 13 14:28:25 GMT 2024
    - 7.3K bytes
    - Viewed (0)
  8. guava-tests/test/com/google/common/util/concurrent/TrustedListenableFutureTaskTest.java

      @GwtIncompatible // blocking wait
      public void testCancel_interrupted() throws Exception {
        final AtomicBoolean interruptedExceptionThrown = new AtomicBoolean();
        final CountDownLatch enterLatch = new CountDownLatch(1);
        final CountDownLatch exitLatch = new CountDownLatch(1);
        final TrustedListenableFutureTask<Integer> task =
            TrustedListenableFutureTask.create(
                new Callable<Integer>() {
                  @Override
    Java
    - Registered: Fri Apr 12 12:43:09 GMT 2024
    - Last Modified: Tue Feb 13 14:28:25 GMT 2024
    - 7.3K bytes
    - Viewed (0)
  9. guava-tests/test/com/google/common/util/concurrent/ListenableFutureTaskTest.java

     */
    public class ListenableFutureTaskTest extends TestCase {
    
      private ExecutorService exec;
    
      protected final CountDownLatch runLatch = new CountDownLatch(1);
      protected final CountDownLatch taskLatch = new CountDownLatch(1);
      protected final CountDownLatch listenerLatch = new CountDownLatch(1);
    
      protected volatile boolean throwException = false;
    
      protected final ListenableFutureTask<Integer> task =
    Java
    - Registered: Fri Apr 12 12:43:09 GMT 2024
    - Last Modified: Wed Sep 06 17:04:31 GMT 2023
    - 4.7K bytes
    - Viewed (0)
  10. guava-testlib/src/com/google/common/util/concurrent/testing/MockFutureListener.java

      public MockFutureListener(ListenableFuture<?> future) {
        this.countDownLatch = new CountDownLatch(1);
        this.future = future;
    
        future.addListener(this, directExecutor());
      }
    
      @Override
      public void run() {
        countDownLatch.countDown();
      }
    
      /**
       * Verify that the listener completes in a reasonable amount of time, and Asserts that the future
       * returns the expected data.
       *
    Java
    - Registered: Fri Apr 19 12:43:09 GMT 2024
    - Last Modified: Fri May 12 18:12:42 GMT 2023
    - 3K bytes
    - Viewed (0)
Back to top