本文整理汇总了Java中java.util.concurrent.ExecutionException.getCause方法的典型用法代码示例。如果您正苦于以下问题:Java ExecutionException.getCause方法的具体用法?Java ExecutionException.getCause怎么用?Java ExecutionException.getCause使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.concurrent.ExecutionException
的用法示例。
在下文中一共展示了ExecutionException.getCause方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validateFederatedMetastoreDatabases
import java.util.concurrent.ExecutionException; //导入方法依赖的package包/类
private void validateFederatedMetastoreDatabases(List<String> mappableDatabases, MetaStoreMapping metaStoreMapping) {
try {
Set<String> allPrimaryDatabases = Sets.newHashSet(primaryDatabasesCache.get(PRIMARY_KEY));
for (String database : mappableDatabases) {
if (allPrimaryDatabases.contains(database.toLowerCase())) {
throw new WaggleDanceException("Database clash, found '"
+ database
+ "' to be mapped for the federated metastore '"
+ metaStoreMapping.getMetastoreMappingName()
+ "' already present in the primary database, please remove the database from the list it can't be accessed via Waggle Dance");
}
if (mappingsByDatabaseName.containsKey(database.toLowerCase())) {
throw new WaggleDanceException("Database clash, found '"
+ database
+ "' to be mapped for the federated metastore '"
+ metaStoreMapping.getMetastoreMappingName()
+ "' already present in another federated database, please remove the database from the list it can't be accessed via Waggle Dance");
}
}
} catch (ExecutionException e) {
throw new WaggleDanceException("Can't validate database clashes", e.getCause());
}
}
示例2: removeLogInfo
import java.util.concurrent.ExecutionException; //导入方法依赖的package包/类
@Override public void removeLogInfo(String name) throws InterruptedException, LedgerStorageException {
CompletableFuture<Void> completableFuture = new CompletableFuture<>();
asyncRemoveLogInfo(name, new CommonCallback<Void, LedgerStorageException>() {
@Override public void onCompleted(Void data, Version version) {
completableFuture.complete(data);
}
@Override public void onThrowable(LedgerStorageException throwable) {
completableFuture.completeExceptionally(throwable);
}
});
try {
completableFuture.get();
} catch (ExecutionException e) {
throw new LedgerStorageException(e.getCause());
}
}
示例3: testAbnormalForkGetSingleton
import java.util.concurrent.ExecutionException; //导入方法依赖的package包/类
/**
* get of a forked task throws exception when task completes abnormally
*/
public void testAbnormalForkGetSingleton() {
ForkJoinTask a = new CheckedRecursiveAction() {
protected void realCompute() throws Exception {
FailingCCF f = new LFCCF(8);
assertSame(f, f.fork());
try {
f.get();
shouldThrow();
} catch (ExecutionException success) {
Throwable cause = success.getCause();
assertTrue(cause instanceof FJException);
checkCompletedAbnormally(f, cause);
}
}};
testInvokeOnPool(singletonPool(), a);
}
示例4: rethrowExecutionException
import java.util.concurrent.ExecutionException; //导入方法依赖的package包/类
static RuntimeException rethrowExecutionException(ExecutionException e) {
if (e.getCause() instanceof ElasticsearchException) {
ElasticsearchException esEx = (ElasticsearchException) e.getCause();
Throwable root = esEx.unwrapCause();
if (root instanceof ElasticsearchException) {
return (ElasticsearchException) root;
} else if (root instanceof RuntimeException) {
return (RuntimeException) root;
}
return new UncategorizedExecutionException("Failed execution", root);
} else if (e.getCause() instanceof RuntimeException) {
return (RuntimeException) e.getCause();
} else {
return new UncategorizedExecutionException("Failed execution", e);
}
}
示例5: read
import java.util.concurrent.ExecutionException; //导入方法依赖的package包/类
@Override
public synchronized AnswerKey read(final Symbol docid) throws IOException {
assertNotClosed();
try {
if (doCaching) {
return cache.get(docid);
} else {
return uncachedRead(docid);
}
} catch (ExecutionException e) {
log.info("Caught exception {}", e);
if (e.getCause() instanceof IOException) {
throw (IOException) e.getCause();
} else {
throw new RuntimeException(e.getCause());
}
}
}
示例6: get
import java.util.concurrent.ExecutionException; //导入方法依赖的package包/类
@Override
public ClusterNode get() throws InterruptedException, LeaderException {
try {
return super.get();
} catch (ExecutionException e) {
throw new LeaderException(e.getMessage(), e.getCause());
}
}
示例7: get
import java.util.concurrent.ExecutionException; //导入方法依赖的package包/类
@Override
public Hekate get() throws InterruptedException, HekateFutureException {
try {
return super.get();
} catch (ExecutionException e) {
throw new HekateFutureException(e.getCause().getMessage(), e.getCause());
}
}
示例8: getMapper
import java.util.concurrent.ExecutionException; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public <T> NeutrinoObjectMapper<T> getMapper(Class<T> type) throws ObjectMappingException {
Preconditions.checkNotNull(type, "type");
try {
return (NeutrinoObjectMapper<T>) mapperCache.get(type);
} catch (ExecutionException e) {
if (e.getCause() instanceof ObjectMappingException) {
throw (ObjectMappingException) e.getCause();
} else {
throw new ObjectMappingException(e);
}
}
}
示例9: getUninterruptedly
import java.util.concurrent.ExecutionException; //导入方法依赖的package包/类
@Override
public Hekate getUninterruptedly() throws HekateFutureException {
try {
return super.getUninterruptedly();
} catch (ExecutionException e) {
throw new HekateFutureException(e.getCause().getMessage(), e.getCause());
}
}
示例10: dispatch
import java.util.concurrent.ExecutionException; //导入方法依赖的package包/类
/**
* Get the transform result and dispatch.
*
* @throws BiremeException transform failed
* @throws InterruptedException if the current thread was interrupted while waiting
*/
public void dispatch() throws BiremeException, InterruptedException {
if (rowSet != null) {
complete = insertRowSet();
if (!complete) {
return;
}
}
while (!transResult.isEmpty() && !cxt.stop) {
Future<RowSet> head = transResult.peek();
if (head.isDone()) {
transResult.remove();
try {
rowSet = head.get();
} catch (ExecutionException e) {
throw new BiremeException("Transform failed.\n", e.getCause());
}
complete = insertRowSet();
if (!complete) {
break;
}
} else {
break;
}
}
}
示例11: buildDownloadExecutor
import java.util.concurrent.ExecutionException; //导入方法依赖的package包/类
private static ExecutorService buildDownloadExecutor() {
final int maxConcurrent = 5;
// Create a bounded thread pool for executing downloads; it creates
// threads as needed (up to maximum) and reclaims them when finished.
final ThreadPoolExecutor executor = new ThreadPoolExecutor(
maxConcurrent, maxConcurrent, 10, TimeUnit.SECONDS,
new LinkedBlockingQueue<Runnable>()) {
@Override
protected void afterExecute(Runnable r, Throwable t) {
super.afterExecute(r, t);
if (t == null && r instanceof Future<?>) {
try {
((Future<?>) r).get();
} catch (CancellationException ce) {
t = ce;
} catch (ExecutionException ee) {
t = ee.getCause();
} catch (InterruptedException ie) {
Thread.currentThread().interrupt();
}
}
if (t != null) {
Log.w(TAG, "Uncaught exception", t);
}
}
};
executor.allowCoreThreadTimeOut(true);
return executor;
}
示例12: runGetIdempotencyTest
import java.util.concurrent.ExecutionException; //导入方法依赖的package包/类
@GwtIncompatible // reflection
private static void runGetIdempotencyTest(
Future<Integer> transformedFuture, Class<? extends Throwable> expectedExceptionClass)
throws Throwable {
for (int i = 0; i < 5; i++) {
try {
getDone(transformedFuture);
fail();
} catch (ExecutionException expected) {
if (!expectedExceptionClass.isInstance(expected.getCause())) {
throw expected.getCause();
}
}
}
}
示例13: convertError
import java.util.concurrent.ExecutionException; //导入方法依赖的package包/类
private RuntimeException convertError(ExecutionException e) {
if (e.getCause() instanceof RuntimeException) {
throw (RuntimeException)e.getCause();
} else if (e.getCause() instanceof Error) {
throw (Error)e.getCause();
} else {
// Should never happen.
throw new AssertionError("Unexpected checked exception: " + e.toString(), e);
}
}
示例14: call
import java.util.concurrent.ExecutionException; //导入方法依赖的package包/类
@Override
public Boolean call() throws Exception {
try {
ClassDefItem clazz = futureClazz.get();
if (clazz != null) {
addClassToDex(clazz);
updateStatus(true);
}
return true;
} catch (ExecutionException ex) {
// Rethrow previously uncaught translation exceptions.
// These, as well as any exceptions from addClassToDex,
// are handled and reported in processAllFiles().
Throwable t = ex.getCause();
throw (t instanceof Exception) ? (Exception) t : ex;
} finally {
if (args.multiDex) {
// Having added our actual indicies to the dex file,
// we subtract our original estimate from the total estimate,
// and signal the translation phase, which may be paused
// waiting to determine if more classes can be added to the
// current dex file, or if a new dex file must be created.
synchronized (dexRotationLock) {
maxMethodIdsInProcess -= maxMethodIdsInClass;
maxFieldIdsInProcess -= maxFieldIdsInClass;
dexRotationLock.notifyAll();
}
}
}
}
示例15: getFactTypeOrFail
import java.util.concurrent.ExecutionException; //导入方法依赖的package包/类
private FactTypeEntity getFactTypeOrFail(UUID id) {
try {
return factTypeByIdCache.get(id);
} catch (ExecutionException e) {
throw new IllegalArgumentException(e.getCause());
}
}