Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 104 for CountDownLatch (0.19 sec)

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

        Executor exec = Executors.newCachedThreadPool();
        CountDownLatch countDownLatch = new CountDownLatch(3);
        list.add(new MockRunnable(countDownLatch), exec);
        list.add(new MockRunnable(countDownLatch), exec);
        list.add(new MockRunnable(countDownLatch), exec);
        assertEquals(3L, countDownLatch.getCount());
    
        list.execute();
    
    Java
    - Registered: Fri Apr 12 12:43:09 GMT 2024
    - Last Modified: Wed Feb 09 22:57:07 GMT 2022
    - 4.7K 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 Apr 26 12:43:10 GMT 2024
    - Last Modified: Wed Sep 06 17:04:31 GMT 2023
    - 4.7K bytes
    - Viewed (0)
  3. 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 Apr 26 12:43:10 GMT 2024
    - Last Modified: Wed Sep 06 17:04:31 GMT 2023
    - 6.6K bytes
    - Viewed (0)
  4. 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)
  5. android/guava-tests/test/com/google/common/util/concurrent/ExecutionListTest.java

        Executor exec = Executors.newCachedThreadPool();
        CountDownLatch countDownLatch = new CountDownLatch(3);
        list.add(new MockRunnable(countDownLatch), exec);
        list.add(new MockRunnable(countDownLatch), exec);
        list.add(new MockRunnable(countDownLatch), exec);
        assertEquals(3L, countDownLatch.getCount());
    
        list.execute();
    
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Wed Feb 09 22:57:07 GMT 2022
    - 4.7K bytes
    - Viewed (0)
  6. 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)
  7. 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 Apr 26 12:43:10 GMT 2024
    - Last Modified: Fri May 12 18:12:42 GMT 2023
    - 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. 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 Apr 26 12:43:10 GMT 2024
    - Last Modified: Wed Sep 06 18:30:30 GMT 2023
    - 6K bytes
    - Viewed (0)
  10. 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 Apr 26 12:43:10 GMT 2024
    - Last Modified: Tue Feb 13 14:28:25 GMT 2024
    - 7.3K bytes
    - Viewed (0)
Back to top