List of usage examples for com.google.common.util.concurrent UncheckedExecutionException getCause
public synchronized Throwable getCause()
From source file:com.facebook.buck.core.rules.platform.RuleBasedConstraintResolver.java
@Override public ConstraintValue getConstraintValue(BuildTarget buildTarget) { try {/* www .j ava 2 s .c o m*/ return constraintValueCache.getUnchecked(buildTarget); } catch (UncheckedExecutionException e) { Throwables.throwIfUnchecked(e.getCause()); throw new RuntimeException(e.getCause()); } }
From source file:net.derquinse.bocas.AbstractGuavaCachingBocasService.java
@Override public final Bocas getBucket(String name) { try {//from w ww.ja v a2 s . c om return bucketCache.getUnchecked(name); } catch (UncheckedExecutionException e) { Throwable cause = e.getCause(); if (cause instanceof EntryNotFoundException) { throw new IllegalArgumentException(); } if (cause instanceof BocasException) { throw (BocasException) cause; } throw new BocasException(cause); } }
From source file:org.n52.iceland.util.LazyThreadSafeProducer.java
@Override public T get(Locale language) throws ConfigurationError { if (language == null) { return get(); } else {//from ww w . ja va 2s.com try { return this.cache.getUnchecked(language); } catch (UncheckedExecutionException ex) { if (ex.getCause() instanceof ConfigurationError) { throw (ConfigurationError) ex.getCause(); } else { throw ex; } } } }
From source file:org.apache.twill.internal.CompositeService.java
@Override protected void startUp() throws Exception { Throwable failureCause = null; for (Service service : services) { try {/*from www.j av a2 s . c o m*/ service.startAndWait(); } catch (UncheckedExecutionException e) { failureCause = e.getCause(); break; } } if (failureCause != null) { // Stop all running services and then throw the failure exception try { stopAll(); } catch (Throwable t) { // Ignore the stop error. Just log. LOG.warn("Failed when stopping all services on start failure", t); } Throwables.propagateIfPossible(failureCause, Exception.class); throw new RuntimeException(failureCause); } }
From source file:io.prestosql.plugin.localfile.LocalFileTables.java
public List<File> getFiles(SchemaTableName table) { try {//from w w w . j a v a2s . c o m return cachedFiles.getUnchecked(table); } catch (UncheckedExecutionException e) { throwIfInstanceOf(e.getCause(), PrestoException.class); throw e; } }
From source file:org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.java
@Override public T get() {//www . j ava2s. c o m try { return cache.get("FOO").orNull(); } catch (UncheckedExecutionException e) { throw propagate(e.getCause()); } catch (ExecutionException e) { throw propagate(e.getCause()); } }
From source file:org.icgc.dcc.submission.core.DccRuntime.java
private void tryStopService(Service service) { try {// w w w .jav a2 s.c o m log.info("Service {} is [{}]. Stopping.", service.getClass(), service.state()); service.stopAsync().awaitTerminated(); val expectedState = TERMINATED; val actualState = service.state(); checkState(expectedState == actualState, "Service should be '%s', instead was found '%s'", expectedState, actualState); log.info("Service {} is now [{}]", service.getClass(), actualState); } catch (UncheckedExecutionException e) { log.error("Failed to stop service {}: {}", service.getClass(), e.getCause().getMessage()); throw e; } }
From source file:org.icgc.dcc.submission.core.DccRuntime.java
private void tryStartService(Service service) { try {/*from w w w.ja va 2s.c o m*/ log.info("Service {} is [{}]. Starting.", service.getClass(), service.state()); service.startAsync().awaitRunning(); val expectedState = RUNNING; val actualState = service.state(); checkState(expectedState == actualState, "Service should be '%s', instead was found '%s'", expectedState, actualState); log.info("Service {} is now [{}]", service.getClass(), actualState); } catch (UncheckedExecutionException e) { log.warn("Failed to start service {}: {}", service.getClass(), e.getCause().getMessage()); throw e; } }
From source file:com.isotrol.impe3.pms.core.support.AbstractValueLoader.java
/** * @see com.isotrol.impe3.pms.core.ValueLoader#get(com.isotrol.impe3.pms.model.VersionedEntity, java.lang.Object) *///from www . j a v a 2 s. c o m public final V get(E entity, P payload) { checkNotNull(entity); final Key key = new Key(entity.getId(), entity.getVersion()); try { Loader loader = new Loader(entity, payload, key); return cache.get(key, loader); } catch (UncheckedExecutionException e) { throw new RuntimeException(e.getCause()); // TODO } catch (ExecutionException e) { throw new RuntimeException(e.getCause()); // TODO } }
From source file:org.jclouds.fujitsu.fgcp.suppliers.FGCPCredentialsSupplier.java
@Override public FGCPCredentials get() { try {/*from w ww . ja v a 2 s . co m*/ return keyCache.getUnchecked(checkNotNull(creds.get(), "credential supplier returned null")); } catch (UncheckedExecutionException e) { throw Throwables.propagate(e.getCause()); } }