List of usage examples for java.util.concurrent ExecutionException getMessage
public String getMessage()
From source file:org.centralperf.controller.ApiController.java
/** * export csv with average response size of each sample. * @param runId ID of the run (from URI) * @param model Model prepared for the new project form view * @return CSV with average Response size * @throws IOException /*from w w w. j a v a 2 s. com*/ */ @RequestMapping(value = "/api/getRSChartCSV/{runId}", method = RequestMethod.GET, produces = "text/csv") @ResponseBody public String getRSChartCSV(@PathVariable("runId") Long runId, Model model, HttpServletResponse response) throws IOException { String csv = ""; try { csv = runStatService.getResponseSizeGraph(runId); } catch (ExecutionException ee) { log.error("CSV data could not be retrieve from cache:" + ee.getMessage()); } return csv; }
From source file:org.centralperf.controller.ApiController.java
/** * export csv with average response size of each sample. * @param runId ID of the run (from URI) * @param model Model prepared for the new project form view * @return CSV with average Response size * @throws IOException /*from w w w .j a va 2 s .co m*/ */ @RequestMapping(value = "/api/getERChartCSV/{runId}", method = RequestMethod.GET, produces = "text/csv") @ResponseBody public String getERChartCSV(@PathVariable("runId") Long runId, Model model, HttpServletResponse response) throws IOException { String csv = ""; try { csv = runStatService.getErrorRateGraph(runId); } catch (ExecutionException ee) { log.error("CSV data could not be retrieve from cache:" + ee.getMessage()); } return csv; }
From source file:org.centralperf.controller.ApiController.java
/** * List run data statistics as JSON //from w w w . java 2 s . c o m * @param runId ID of the run (from URI) * @param model * @return JSON run statistics */ @RequestMapping(value = "/api/getRunStatsJSON/{runId}", method = RequestMethod.GET) @ResponseBody public RunStats getRunStatsJSON(@PathVariable("runId") Long runId, Model model) { RunStats temp = null; try { temp = runStatService.getRunStats(runId); } catch (ExecutionException ee) { log.error("JSON data could not be retrieve from cache:" + ee.getMessage()); } return temp; }
From source file:org.apache.metron.common.stellar.BaseStellarProcessor.java
/** * Parses the given rule and returns a set of variables that are used in the given Stellar expression, {@code rule}. * * @param rule The Stellar expression to find out what variables are used. * @return A set of variables used in the given Stellar expression. *//*from ww w. j a va2 s .c o m*/ public Set<String> variablesUsed(final String rule) { if (rule == null || isEmpty(rule.trim())) { return null; } StellarCompiler.Expression expression = null; try { expression = expressionCache.get(rule, () -> compile(rule)); } catch (ExecutionException e) { throw new ParseException("Unable to parse: " + rule + " due to: " + e.getMessage(), e); } return expression.variablesUsed; }
From source file:org.xlrnet.metadict.impl.strategies.CachedLinearExecutionStrategy.java
/** * Execute the given {@link QueryPlan} with the internally provided strategy. The results of each executed {@link * QueryStep} have to be aggregated to a {@link Iterable< Pair <QueryStep, EngineQueryResult >>} that * contains the results of each single step. * * @param queryPlan/*from ww w. ja v a 2 s .com*/ * The query plan that should be executed. The caller of this method has make sure that the provided query * plan is valid. * @return an iterable with the results of each step */ @NotNull @Override public Iterable<QueryStepResult> executeQueryPlan(@NotNull QueryPlan queryPlan) { List<QueryStepResult> queryResults = new ArrayList<>(); for (QueryStep currentQueryStep : queryPlan.getQueryStepList()) { QueryStepResult queryStepResult = QUERY_STEP_RESULT_CACHE.getIfPresent(currentQueryStep); try { if (queryStepResult == null) { LOGGER.debug("Cache miss on query step {}", currentQueryStep); queryStepResult = QUERY_STEP_RESULT_CACHE.get(currentQueryStep, Callables.returning(executeQueryStep(currentQueryStep))); } } catch (ExecutionException e) { LOGGER.error("Query step {} failed", currentQueryStep, e); queryStepResult = new QueryStepResultBuilder().setFailedStep(true).setErrorMessage(e.getMessage()) .setEngineQueryResult(EngineQueryResultBuilder.EMPTY_QUERY_RESULT).build(); } queryResults.add(queryStepResult); } return queryResults; }
From source file:com.couchbase.client.internal.HttpFutureTest.java
@Test public void testCancellation() throws Exception { CountDownLatch latch = new CountDownLatch(1); long timeout = 1000; HttpFuture<CancellableOperation> future = new HttpFuture<CancellableOperation>(latch, timeout); HttpOperation op = new CancellableOperation(); latch.countDown();/*from w w w . j a va 2 s . co m*/ future.setOperation(op); future.cancel(true); try { future.get(); assertTrue("Future did not throw ExecutionException", false); } catch (ExecutionException e) { assertTrue(e.getCause() instanceof CancellationException); assertEquals("Cancelled", e.getCause().getMessage()); } catch (Exception e) { assertTrue(e.getMessage(), false); } }
From source file:org.apache.tajo.worker.NodeStatusUpdater.java
protected NodeHeartbeatResponse sendHeartbeat(NodeHeartbeatRequest requestProto) throws NoSuchMethodException, ClassNotFoundException, ConnectException, ExecutionException { if (resourceTracker == null) { resourceTracker = newStub();/*from ww w . jav a 2 s .c o m*/ } NodeHeartbeatResponse response = null; try { CallFuture<NodeHeartbeatResponse> callBack = new CallFuture<>(); resourceTracker.nodeHeartbeat(callBack.getController(), requestProto, callBack); response = callBack.get(); } catch (InterruptedException e) { LOG.warn(e.getMessage()); } catch (ExecutionException ee) { LOG.warn("TajoMaster failure: " + ee.getMessage()); resourceTracker = null; throw ee; } return response; }
From source file:com.streamsets.pipeline.stage.processor.jdbcmetadata.JdbcMetadataProcessor.java
@Override protected void process(Record record, BatchMaker batchMaker) throws StageException { try {/* w w w.j a v a 2 s.co m*/ ELVars variables = getContext().createELVars(); RecordEL.setRecordInContext(variables, record); TimeEL.setCalendarInContext(variables, Calendar.getInstance()); TimeNowEL.setTimeNowInContext(variables, new Date()); String schema = (schemaEL != null) ? elEvals.dbNameELEval.eval(variables, schemaEL, String.class) : null; String tableName = elEvals.tableNameELEval.eval(variables, tableNameEL, String.class); if (StringUtils.isEmpty(schema)) { schema = null; } // Obtain the record structure from current record LinkedHashMap<String, JdbcTypeInfo> recordStructure = JdbcMetastoreUtil.convertRecordToJdbcType(record, decimalDefaultsConfig.precisionAttribute, decimalDefaultsConfig.scaleAttribute, schemaWriter); if (recordStructure.isEmpty()) { batchMaker.addRecord(record); return; } LinkedHashMap<String, JdbcTypeInfo> tableStructure = null; try { tableStructure = tableCache.get(Pair.of(schema, tableName)); } catch (ExecutionException e) { throw new JdbcStageCheckedException(JdbcErrors.JDBC_203, e.getMessage(), e); } if (tableStructure.isEmpty()) { // Create table schemaWriter.createTable(schema, tableName, recordStructure); tableCache.put(Pair.of(schema, tableName), recordStructure); } else { // Compare tables LinkedHashMap<String, JdbcTypeInfo> columnDiff = JdbcMetastoreUtil.getDiff(tableStructure, recordStructure); if (!columnDiff.isEmpty()) { LOG.trace("Detected drift for table {} - new columns: {}", tableName, StringUtils.join(columnDiff.keySet(), ",")); schemaWriter.alterTable(schema, tableName, columnDiff); tableCache.put(Pair.of(schema, tableName), recordStructure); } } batchMaker.addRecord(record); } catch (JdbcStageCheckedException error) { LOG.error("Error happened when processing record", error); LOG.trace("Record that caused the error: {}", record.toString()); errorRecordHandler.onError(new OnRecordErrorException(record, error.getErrorCode(), error.getParams())); } }
From source file:org.entrystore.ldcache.cache.impl.CacheImpl.java
void throttle(URI uri) { String hostname = java.net.URI.create(uri.stringValue()).getHost(); try {// www. j a v a 2 s . co m rateLimiters.get(hostname, new Callable<RateLimiter>() { @Override public RateLimiter call() throws Exception { return RateLimiter.create(rateLimit); } }).acquire(); } catch (ExecutionException e) { log.error(e.getMessage()); } }
From source file:org.codice.pubsub.server.SubscriptionServer.java
private void processSubscriptions() { while (!Thread.currentThread().isInterrupted()) { //Fetch Subscriptions Dictionary subMap = getSubscriptionMap(); if (subMap != null) { Enumeration e = subMap.keys(); while (e.hasMoreElements()) { String subscriptionId = (String) e.nextElement(); if (!subscriptionId.equals("service.pid")) { String subscriptionMsg = (String) subMap.get(subscriptionId); int status = checkProcessingStatus(subscriptionId); if (status == PROCESS_STATUS_COMPLETE) { Future<QueryControlInfo> future = processMap.get(subscriptionId); if (future != null) { boolean done = future.isDone(); if (done) { try { QueryControlInfo ctrlInfo = future.get(); processMap.remove(subscriptionId); runQuery(subscriptionMsg, ctrlInfo.getQueryEndDateTime()); } catch (InterruptedException ie) { LOGGER.error(ie.getMessage()); } catch (ExecutionException ee) { LOGGER.error(ee.getMessage()); }//from w w w . j a v a 2 s . c om } } } else if (status == PROCESS_STATUS_NOT_EXIST) { runQuery(subscriptionMsg, new DateTime().minusSeconds(1)); } else if (status == PROCESS_STATUS_NOT_EXIST) { //Do Nothing For Now } } } } else { try { Thread.sleep(5000); } catch (InterruptedException e) { e.printStackTrace(); } } } }