Search Options

Results per page
Sort
Preferred Languages
Advance

Results 41 - 50 of 509 for Future (0.18 sec)

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

                return i;
              }
            };
    
        List<Future<Integer>> futures = executor.invokeAll(Collections.nCopies(10, incrementTask));
    
        for (int i = 0; i < 10; i++) {
          Future<Integer> future = futures.get(i);
          assertTrue("Task should have been run before being returned", future.isDone());
          assertEquals(i, future.get().intValue());
        }
    
    Java
    - Registered: Fri Apr 12 12:43:09 GMT 2024
    - Last Modified: Wed Sep 06 17:04:31 GMT 2023
    - 28.2K bytes
    - Viewed (3)
  2. guava-tests/test/com/google/common/util/concurrent/FutureCallbackTest.java

              }
    
              @Override
              public void onFailure(Throwable t) {
                failureCalls[0]++;
              }
            };
        addCallback(future, callback, directExecutor());
        future.set(result);
        assertEquals(result, future.get());
        assertThat(successCalls[0]).isEqualTo(1);
        assertThat(failureCalls[0]).isEqualTo(0);
      }
    
      public void testOnSuccessThrowsError() throws Exception {
    Java
    - Registered: Fri Apr 12 12:43:09 GMT 2024
    - Last Modified: Tue Nov 15 16:33:21 GMT 2022
    - 6.3K bytes
    - Viewed (0)
  3. android/guava/src/com/google/common/util/concurrent/AbstractCatchingFuture.java

          Class<X> exceptionType,
          Function<? super X, ? extends V> fallback,
          Executor executor) {
        CatchingFuture<V, X> future = new CatchingFuture<>(input, exceptionType, fallback);
        input.addListener(future, rejectionPropagatingExecutor(executor, future));
        return future;
      }
    
      static <X extends Throwable, V extends @Nullable Object> ListenableFuture<V> create(
          ListenableFuture<? extends V> input,
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Thu Feb 01 21:46:34 GMT 2024
    - 8.7K bytes
    - Viewed (0)
  4. android/guava/src/com/google/common/util/concurrent/ExecutionSequencer.java

     *       Future} is "completed" even if it is cancelled while its underlying work continues on a
     *       thread, an RPC, etc. The {@code Future} is also "completed" if it fails "early" -- for
     *       example, if the deadline expires on a {@code Future} returned from {@link
     *       Futures#withTimeout} while the {@code Future} it wraps continues its underlying work. So
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Thu Feb 01 21:46:34 GMT 2024
    - 22.1K bytes
    - Viewed (0)
  5. guava-tests/test/com/google/common/util/concurrent/TestPlatform.java

      }
    
      /**
       * Retrieves the result of a {@code Future} known to be done but uses the {@code get(long,
       * TimeUnit)} overload in order to test that method.
       */
      static <V> V getDoneFromTimeoutOverload(Future<V> future) throws ExecutionException {
        checkState(future.isDone(), "Future was expected to be done: %s", future);
        try {
          return getUninterruptibly(future, 0, SECONDS);
        } catch (TimeoutException e) {
    Java
    - Registered: Fri Apr 12 12:43:09 GMT 2024
    - Last Modified: Mon Dec 04 17:37:03 GMT 2017
    - 2.9K bytes
    - Viewed (0)
  6. futures/listenablefuture1/src/com/google/common/util/concurrent/ListenableFuture.java

     * result. (If you want such access, you may prefer {@link Futures#addCallback
     * Futures.addCallback}.) Still, direct {@code addListener} calls are occasionally useful:
     *
     * <pre>{@code
     * final String name = ...;
     * inFlight.add(name);
     * ListenableFuture<Result> future = service.query(name);
     * future.addListener(new Runnable() {
     *   public void run() {
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Mon Jun 26 21:13:41 GMT 2023
    - 8K bytes
    - Viewed (0)
  7. guava-testlib/test/com/google/common/util/concurrent/testing/TestingExecutorsTest.java

                return taskDone;
              }
            };
        List<Future<Boolean>> futureList =
            executor.invokeAll(ImmutableList.of(task), 10, TimeUnit.MILLISECONDS);
        Future<Boolean> future = futureList.get(0);
        assertFalse(taskDone);
        assertTrue(future.isDone());
        assertThrows(CancellationException.class, () -> future.get());
      }
    
    Java
    - Registered: Fri Apr 19 12:43:09 GMT 2024
    - Last Modified: Wed Sep 06 17:04:31 GMT 2023
    - 3.7K bytes
    - Viewed (0)
  8. android/guava-tests/test/com/google/common/util/concurrent/AbstractAbstractFutureTest.java

      private static void assertSetAsynchronously(AbstractFuture<Integer> future) {
        assertCannotSet(future);
        assertPending(future);
      }
    
      private static void assertPending(AbstractFuture<Integer> future) {
        assertThat(future.isDone()).isFalse();
        assertThat(future.isCancelled()).isFalse();
    
        CountingRunnable listener = new CountingRunnable();
        future.addListener(listener, directExecutor());
        listener.assertNotRun();
    Java
    - Registered: Fri May 03 12:43:13 GMT 2024
    - Last Modified: Tue Feb 13 14:28:25 GMT 2024
    - 15.5K bytes
    - Viewed (0)
  9. guava-tests/test/com/google/common/util/concurrent/UncheckedThrowingFuture.java

        UncheckedThrowingFuture<V> future = new UncheckedThrowingFuture<V>();
        future.complete(checkNotNull(error));
        return future;
      }
    
      public static <V> ListenableFuture<V> throwingRuntimeException(RuntimeException e) {
        UncheckedThrowingFuture<V> future = new UncheckedThrowingFuture<V>();
        future.complete(checkNotNull(e));
        return future;
      }
    
    Java
    - Registered: Fri Apr 12 12:43:09 GMT 2024
    - Last Modified: Wed Sep 12 20:02:10 GMT 2018
    - 3.2K bytes
    - Viewed (0)
  10. android/guava/src/com/google/common/util/concurrent/AsyncCallable.java

     * result.
     *
     * @since 20.0
     */
    @GwtCompatible
    @ElementTypesAreNonnullByDefault
    public interface AsyncCallable<V extends @Nullable Object> {
      /**
       * Computes a result {@code Future}. The output {@code Future} need not be {@linkplain
       * Future#isDone done}, making {@code AsyncCallable} suitable for asynchronous derivations.
       *
       * <p>Throwing an exception from this method is equivalent to returning a failing {@link
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Tue Dec 14 15:53:12 GMT 2021
    - 1.5K bytes
    - Viewed (0)
Back to top