Refine search
@Override public void run() { _started = true; _latch.countDown(); try { _future.get(); _done = true; } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ExecutionException e) { // TODO Auto-generated catch block e.printStackTrace(); } _latch2.countDown(); }
ecs.take().get(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } catch (ExecutionException e) { System.out.println("Execution exception " + e.getMessage()); e.printStackTrace(); for (Future<Void> future : allFutures) { if (!future.isDone()) {
while(!futureKVs.isEmpty()) { Future<String> future = futureKVs.poll(); String keyVersions = future.get(); kvWriter.append(keyVersions); } catch(ExecutionException ee) { logger.error("Encountered an execution exception while sampling " + storeName, ee); ee.printStackTrace(); return false; } finally {
NodeSampleResult nodeSampleResult = future.get(); if(!nodeSampleResult.success) { success = false; logger.error("Encountered an execution exception on node " + node.getHost() + " while sampling " + storeName, ee); ee.printStackTrace(); } catch(InterruptedException ie) { success = false;
/** * Test that a BadRequestException can be thrown and not count towards errors and bypasses fallback. */ @Test public void testBadRequestExceptionViaQueueInThread() throws Exception { TestCircuitBreaker circuitBreaker = new TestCircuitBreaker(); BadRequestCommand command1 = null; try { command1 = new BadRequestCommand(circuitBreaker, ExecutionIsolationStrategy.THREAD); command1.queue().get(); fail("we expect to receive a " + HystrixBadRequestException.class.getSimpleName()); } catch (ExecutionException e) { e.printStackTrace(); if (e.getCause() instanceof HystrixBadRequestException) { // success } else { fail("We expect a " + HystrixBadRequestException.class.getSimpleName() + " but got a " + e.getClass().getSimpleName()); } } assertCommandExecutionEvents(command1, HystrixEventType.BAD_REQUEST); assertNotNull(command1.getExecutionException()); assertEquals(0, circuitBreaker.metrics.getCurrentConcurrentExecutionCount()); assertSaneHystrixRequestLog(1); }
private void testBadRequestExceptionOnResponseFromCache(ExecutionIsolationStrategy isolationStrategy, boolean asyncException) { TestCircuitBreaker circuitBreaker = new TestCircuitBreaker(); KnownHystrixBadRequestFailureTestCommand command1 = new KnownHystrixBadRequestFailureTestCommand(circuitBreaker, isolationStrategy, asyncException); // execute once to cache the value try { command1.observe().toBlocking().single(); } catch (Throwable e) { // ignore } KnownHystrixBadRequestFailureTestCommand command2 = new KnownHystrixBadRequestFailureTestCommand(circuitBreaker, isolationStrategy, asyncException); try { command2.observe().toBlocking().toFuture().get(); fail("we expect to receive a " + HystrixBadRequestException.class.getSimpleName()); } catch (ExecutionException e) { e.printStackTrace(); if (e.getCause() instanceof HystrixBadRequestException) { // success } else { fail("We expect a " + HystrixBadRequestException.class.getSimpleName() + " but got a " + e.getClass().getSimpleName()); } } catch (Exception e) { e.printStackTrace(); fail(); } assertCommandExecutionEvents(command1, HystrixEventType.BAD_REQUEST); assertCommandExecutionEvents(command2, HystrixEventType.BAD_REQUEST); assertSaneHystrixRequestLog(2); assertNotNull(command1.getExecutionException()); assertNotNull(command2.getExecutionException()); }
try { command2 = new BadRequestCommand(circuitBreaker, ExecutionIsolationStrategy.THREAD); command2.queue().get(); fail("we expect to receive a " + HystrixBadRequestException.class.getSimpleName()); } catch (ExecutionException e) { e.printStackTrace(); if (e.getCause() instanceof HystrixBadRequestException) {
protected boolean wait(List<Future<?>> futureList) throws Exception { boolean isSuccess = false; for (final Future<?> f : futureList) { try { f.get(); isSuccess = true; } catch (final InterruptedException e) { e.printStackTrace(); } catch (final ExecutionException e) { e.printStackTrace(); throw e; } } return isSuccess; } }
Future<Boolean> f3 = r3.observe().toBlocking().toFuture(); try { f3.get(); e.printStackTrace(); assertTrue(r3.isResponseTimedOut());
Future<Boolean> f3 = r3.observe().toBlocking().toFuture(); try { f3.get(); e.printStackTrace(); assertTrue(r3.isResponseTimedOut()); assertNotNull(r3.getExecutionException());
private <E> void waitFor(List<ListenableFuture<E>> futures) { for (Future<E> future : futures) { try { future.get(); } catch (InterruptedException e) { throw new RuntimeException("Interrupted while waiting for future", e); } catch (ExecutionException e) { e.printStackTrace(); fail(e.getMessage()); } } }
Future<Boolean> f3 = r3.queue(); try { f3.get(); e.printStackTrace(); assertTrue(r3.isResponseTimedOut());
Future<Boolean> f3 = r3.queue(); try { f3.get(); e.printStackTrace(); assertTrue(r3.isResponseTimedOut());
TaskStats taskStats = null; try { taskStats = future.get(); } catch (final InterruptedException e) { e.printStackTrace(); } catch (final ExecutionException e) { e.printStackTrace();
public void waitAllFutureAndCanInterrupt() throws InterruptedException { for (Future<?> f : futureList) { try { f.get(); } catch (ExecutionException e) { e.printStackTrace(); } } }
public void waitForCompletion() { for (Future<Object> each : futures) try { each.get(); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } }
public void waitForCompletion() { for (Future<Object> each : futures) try { each.get(); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } }
public void waitForCompletion() { for (Future<Object> each : futures) try { each.get(); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } }
public void waitForCompletion() { for (Future<Object> each : futures) try { each.get(); } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } }
public void waitAllFuture() { for (Future<?> f : futureList) { try { f.get(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); break; } catch (ExecutionException e) { e.printStackTrace(); } } }