Examples of UncheckedExecutionException


Examples of com.google.common.util.concurrent.UncheckedExecutionException

    }
  }

  public void testBulkLoadingExceptionWithCause() {
    final Exception cause = new Exception();
    final UncheckedExecutionException uee = new UncheckedExecutionException(cause);
    final ExecutionException ee = new ExecutionException(cause);

    LoadingCache<Object, Object> cacheUnchecked =
        CacheBuilder.newBuilder().build(bulkLoader(exceptionLoader(uee)));
    LoadingCache<Object, Object> cacheChecked =
View Full Code Here

Examples of com.google.common.util.concurrent.UncheckedExecutionException

      } catch (ExecutionException ee) {
        Throwable cause = ee.getCause();
        if (cause instanceof Error) {
          throw new ExecutionError((Error) cause);
        } else if (cause instanceof RuntimeException) {
          throw new UncheckedExecutionException(cause);
        }
        throw ee;
      } finally {
        postReadCleanup();
      }
View Full Code Here

Examples of com.google.common.util.concurrent.UncheckedExecutionException

      boolean completed = jobComplete.apply(job.getJobId());
      logger.trace("<< job(%s) complete(%s)", job, completed);
      AsyncJob<T> jobWithResult = client.getAsyncJobApi().<T> getAsyncJob(job.getJobId());
      checkState(completed, "job %s failed to complete in time %s", job.getJobId(), jobWithResult);
      if (jobWithResult.getError() != null)
         throw new UncheckedExecutionException(String.format("job %s failed with exception %s", job.getJobId(),
               jobWithResult.getError().toString())) {
         };
      return jobWithResult.getResult();
   }
View Full Code Here

Examples of com.google.common.util.concurrent.UncheckedExecutionException

   public void testLoaderThrowsAuthorizationExceptionAndAlsoSetsExceptionTypeWhenInUncheckedExecutionException() {
      AtomicReference<AuthorizationException> authException = newReference();
      try {
         new SetAndThrowAuthorizationExceptionSupplierBackedLoader<String>(new Supplier<String>() {
            public String get() {
               throw new UncheckedExecutionException(new AuthorizationException());
            }
         }, authException).load("KEY");
      } finally {
         assertEquals(authException.get().getClass(), AuthorizationException.class);
      }
View Full Code Here

Examples of com.google.common.util.concurrent.UncheckedExecutionException

   @SuppressWarnings("serial")
   @DataProvider(name = "exceptions")
   public Object[][] createExceptions() {
      return new Object[][] { { new ExecutionException() {
      } }, { new UncheckedExecutionException() {
      } }, { new InvalidCacheLoadException("foo") } };
   }
View Full Code Here

Examples of com.google.common.util.concurrent.UncheckedExecutionException

   @Test(expectedExceptions = UncheckedExecutionException.class)
   void testDoesntCatchOtherExceptions() {
      BackoffOnNotFoundWhenGetBucketACL backoff = new BackoffOnNotFoundWhenGetBucketACL(mock);

      expect(mock.getBucketACL("foo")).andThrow(new UncheckedExecutionException(new TimeoutException()));

      replay(mock);
      backoff.load("foo");
      verify(mock);
   }
View Full Code Here

Examples of com.google.common.util.concurrent.UncheckedExecutionException

    public V getUnchecked(K key) {
      try {
        return get(key);
      } catch (ExecutionException e) {
        throw new UncheckedExecutionException(e.getCause());
      }
    }
View Full Code Here

Examples of com.google.common.util.concurrent.UncheckedExecutionException

    @Override
    public V getUnchecked(K key) {
        try {
            return get(key);
        } catch (ExecutionException e) {
            throw new UncheckedExecutionException(e);
        }
    }
View Full Code Here

Examples of com.google.common.util.concurrent.UncheckedExecutionException

      boolean completed = jobComplete.apply(job.getJobId());
      logger.trace("<< job(%s) complete(%s)", job, completed);
      AsyncJob<T> jobWithResult = client.getAsyncJobClient().<T> getAsyncJob(job.getJobId());
      checkState(completed, "job %s failed to complete in time %s", job.getJobId(), jobWithResult);
      if (jobWithResult.getError() != null)
         throw new UncheckedExecutionException(String.format("job %s failed with exception %s", job.getJobId(),
               jobWithResult.getError().toString())) {
         };
      return jobWithResult.getResult();
   }
View Full Code Here

Examples of com.google.common.util.concurrent.UncheckedExecutionException

   public void testLoaderThrowsAuthorizationExceptionAndAlsoSetsExceptionTypeWhenInUncheckedExecutionException() {
      AtomicReference<AuthorizationException> authException = newReference();
      try {
         new SetAndThrowAuthorizationExceptionSupplierBackedLoader<String>(new Supplier<String>() {
            public String get() {
               throw new UncheckedExecutionException(new AuthorizationException());
            }
         }, authException).load("KEY");
      } finally {
         assertEquals(authException.get().getClass(), AuthorizationException.class);
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.