当前位置: 首页>>代码示例>>Java>>正文


Java ExecutionException.getCause方法代码示例

本文整理汇总了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());
  }
}
 
开发者ID:HotelsDotCom,项目名称:waggle-dance,代码行数:24,代码来源:StaticDatabaseMappingService.java

示例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());
    }
}
 
开发者ID:aCoder2013,项目名称:fastmq,代码行数:18,代码来源:LogInfoStorageImpl.java

示例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);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:CountedCompleterTest.java

示例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);
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:17,代码来源:AdapterActionFuture.java

示例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());
    }
  }
}
 
开发者ID:isi-nlp,项目名称:tac-kbp-eal,代码行数:19,代码来源:AssessmentSpecFormats.java

示例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());
    }
}
 
开发者ID:hekate-io,项目名称:hekate,代码行数:9,代码来源:LeaderFuture.java

示例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());
    }
}
 
开发者ID:hekate-io,项目名称:hekate,代码行数:9,代码来源:LeaveFuture.java

示例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);
        }
    }
}
 
开发者ID:NucleusPowered,项目名称:Neutrino,代码行数:15,代码来源:NeutrinoObjectMapperFactory.java

示例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());
    }
}
 
开发者ID:hekate-io,项目名称:hekate,代码行数:9,代码来源:LeaveFuture.java

示例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;
    }
  }
}
 
开发者ID:HashDataInc,项目名称:bireme,代码行数:37,代码来源:Dispatcher.java

示例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;
}
 
开发者ID:redleaf2002,项目名称:downloadmanager,代码行数:33,代码来源:DownloadService.java

示例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();
      }
    }
  }
}
 
开发者ID:paul-hammant,项目名称:googles-monorepo-demo,代码行数:16,代码来源:FuturesTest.java

示例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);
    }
}
 
开发者ID:hekate-io,项目名称:hekate,代码行数:11,代码来源:DefaultDistributedLock.java

示例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();
            }
        }
    }
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:31,代码来源:Main.java

示例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());
  }
}
 
开发者ID:mnemonic-no,项目名称:act-platform,代码行数:8,代码来源:FactManager.java


注:本文中的java.util.concurrent.ExecutionException.getCause方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。