/** * If an exception exists, will throw the exception and then clear it. This is so in cases where want to reuse * DeferredException, we don't double report the same exception. * * @throws Exception */ public synchronized void throwAndClear() throws Exception { final Exception e = getAndClear(); if (e != null) { throw e; } }
/** * If an exception exists, will throw the exception and then clear it. This is so in cases where want to reuse * DeferredException, we don't double report the same exception. * * @throws Exception */ public synchronized void throwAndClearRuntime() { final Exception e = getAndClear(); if(e != null){ throw Throwables.propagate(e); } }
@Override public RawFragmentBatch poll() { Exception ex = SpoolingRawBatchBuffer.this.deferred.getAndClear(); if(ex != null){ throw new RuntimeException(ex); } RawFragmentBatchWrapper batchWrapper = buffer.poll(); if (batchWrapper != null) { return batchWrapper.get(); } return null; }
@Override public void run() { try { UserResult finalResult = result; if(deferred.hasException()){ finalResult = finalResult.withException(deferred.getAndClear()); } innerObserver.attemptCompletion(finalResult); } finally { cd.countDown(); } } });
sb.append(":\n\n"); sb.append(getAvailableHosts()); logger.info(sb.toString(), ex.getAndClear()); } else { StringBuilder sb = new StringBuilder(); throw new RuntimeException("Unable to get host lists from any host seed.", ex.getAndClear());
final UserException uex = UserException.systemError(deferredException.getAndClear()) .addIdentity(fragment.getAssignment()) .addContext("Fragment", handle.getMajorFragmentId() + ":" + handle.getMinorFragmentId())