public static void sleepSec(int sec) { try { TimeUnit.SECONDS.sleep(sec); } catch (InterruptedException e) { log.warn("Caught exception: " + ExceptionUtils.getFullStackTrace(e)); } } public static void sleepMilliSec(int milliSec) {
public static void sleepMilliSec(int milliSec) { try { TimeUnit.MILLISECONDS.sleep(milliSec); } catch (InterruptedException e) { log.warn("Caught exception: " + ExceptionUtils.getFullStackTrace(e)); } }
private String getJobExceptionStack(Throwable e) { if (e == null) { return ""; } Throwable cause = ExceptionUtils.getRootCause(e); if (cause != null) { return ExceptionUtils.getFullStackTrace(cause); } else { return ExceptionUtils.getFullStackTrace(e); } }
public ForkException getAggregatedException (List<Integer> failedForkIds, String taskId) { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append("Fork branches " + failedForkIds + " failed for task " + taskId + "\n"); for (Integer idx: failedForkIds) { stringBuffer.append("<Fork " + idx + ">\n"); if (this.throwables.containsKey(idx)) { stringBuffer.append(ExceptionUtils.getFullStackTrace(this.throwables.get(idx))); } else { stringBuffer.append("Cannot find throwable entry in ForkThrowableHolder\n"); } } return new ForkException(stringBuffer.toString()); } }
@Override public void onJobStart(JobContext jobContext) throws Exception { StringBuffer buf = new StringBuffer(); for (JobListener listener: listeners) { try { listener.onJobStart(jobContext); } catch (Exception e) { buf.append(listener.getClass().getName() + ":" + e.toString()); log.error(ExceptionUtils.getFullStackTrace(e)); } } String exceptions = buf.toString(); if (!exceptions.isEmpty()) { throw new RuntimeException(exceptions); } }
@Override public void onJobPrepare(JobContext jobContext) throws Exception { StringBuffer buf = new StringBuffer(); for (JobListener listener: listeners) { try { listener.onJobPrepare(jobContext); } catch (Exception e) { buf.append(listener.getClass().getName() + ":" + e.toString()); log.error(ExceptionUtils.getFullStackTrace(e)); } } String exceptions = buf.toString(); if (!exceptions.isEmpty()) { throw new RuntimeException(exceptions); } }
@Override public void onJobCompletion(JobContext jobContext) throws Exception { StringBuffer buf = new StringBuffer(); for (JobListener listener: listeners) { try { listener.onJobCompletion(jobContext); } catch (Exception e) { buf.append(listener.getClass().getName() + ":" + e.toString()); log.error(ExceptionUtils.getFullStackTrace(e)); } } String exceptions = buf.toString(); if (!exceptions.isEmpty()) { throw new RuntimeException(exceptions); } }
@Override public void onJobCancellation(JobContext jobContext) throws Exception { StringBuffer buf = new StringBuffer(); for (JobListener listener: listeners) { try { listener.onJobCancellation(jobContext); } catch (Exception e) { buf.append(listener.getClass().getName() + ":" + e.toString()); log.error(ExceptionUtils.getFullStackTrace(e)); } } String exceptions = buf.toString(); if (!exceptions.isEmpty()) { throw new RuntimeException(exceptions); } }
@Override public void onJobFailure(JobContext jobContext) throws Exception { StringBuffer buf = new StringBuffer(); for (JobListener listener: listeners) { try { listener.onJobFailure(jobContext); } catch (Exception e) { buf.append(listener.getClass().getName() + ":" + e.toString()); log.error(ExceptionUtils.getFullStackTrace(e)); } } String exceptions = buf.toString(); if (!exceptions.isEmpty()) { throw new RuntimeException(exceptions); } } }
@Override public void onFailure(Throwable t) { ComplianceRestoreJob.this.finishCleanSignal.get().countDown(); log.warn("Exception caught when restoring " + dataset.datasetURN() + ".", t); ComplianceRestoreJob.this.throwables.add(t); ComplianceRestoreJob.this.eventSubmitter.submit(ComplianceEvents.Restore.FAILED_EVENT_NAME, ImmutableMap .of(ComplianceEvents.FAILURE_CONTEXT_METADATA_KEY, ExceptionUtils.getFullStackTrace(t), ComplianceEvents.DATASET_URN_METADATA_KEY, dataset.datasetURN())); } });
@Override public void onFailure(Throwable t) { ComplianceRetentionJob.this.finishCleanSignal.get().countDown(); log.warn("Exception caught when cleaning " + dataset.datasetURN() + ".", t); ComplianceRetentionJob.this.throwables.add(t); ComplianceRetentionJob.this.eventSubmitter.submit(ComplianceEvents.Retention.FAILED_EVENT_NAME, ImmutableMap .of(ComplianceEvents.FAILURE_CONTEXT_METADATA_KEY, ExceptionUtils.getFullStackTrace(t), ComplianceEvents.DATASET_URN_METADATA_KEY, dataset.datasetURN())); } });
public void run() { if (controller.isStart()) { try { logger.info("## stop the YuGong"); controller.stop(); } catch (Throwable e) { logger.warn("## something goes wrong when stopping YuGong:\n{}", ExceptionUtils.getFullStackTrace(e)); } finally { logger.info("## YuGong is down."); } } }
@Override public void onFailure(Throwable t) { ComplianceValidationJob.this.finishCleanSignal.get().countDown(); log.warn("Exception caught when validating " + dataset.datasetURN() + ".", t); ComplianceValidationJob.this.throwables.add(t); ComplianceValidationJob.this.eventSubmitter.submit(ComplianceEvents.Validation.FAILED_EVENT_NAME, ImmutableMap .of(ComplianceEvents.FAILURE_CONTEXT_METADATA_KEY, ExceptionUtils.getFullStackTrace(t), ComplianceEvents.DATASET_URN_METADATA_KEY, dataset.datasetURN())); } });
@Override public void onFailure(Throwable throwable) { DatasetCleaner.this.finishCleanSignal.get().countDown(); LOG.warn("Exception caught when cleaning " + dataset.datasetURN() + ".", throwable); DatasetCleaner.this.throwables.add(throwable); Instrumented.markMeter(DatasetCleaner.this.datasetsCleanFailureMeter); DatasetCleaner.this.eventSubmitter.submit(RetentionEvents.CleanFailed.EVENT_NAME, ImmutableMap.of(RetentionEvents.CleanFailed.FAILURE_CONTEXT_METADATA_KEY, ExceptionUtils.getFullStackTrace(throwable), RetentionEvents.DATASET_URN_METADATA_KEY, dataset.datasetURN())); }
private boolean processException(Throwable e, int i) { if (!(ExceptionUtils.getRootCause(e) instanceof InterruptedException)) { logger.error("retry {} ,something error happened. caused by {}", (i + 1), ExceptionUtils.getFullStackTrace(e)); try { alarmService.sendAlarm(new AlarmMessage(ExceptionUtils.getFullStackTrace(e), alarmReceiver)); } catch (Throwable e1) { logger.error("send alarm failed. ", e1); } try { Thread.sleep(retryInterval); } catch (InterruptedException e1) { exception = new YuGongException(e1); Thread.currentThread().interrupt(); return true; } } else { // interrupt事件,响应退出 return true; } return false; }
} else { throw new EnhancedServiceNotFoundException( "not found service provider for : " + service.getName() + " caused by " + ExceptionUtils.getFullStackTrace(e));
public ThrottledHttpClient (SharedResourcesBroker<GobblinScopeTypes> broker, String limiterKey) { this.broker = broker; try { this.limiter = broker.getSharedResource(new SharedLimiterFactory<>(), new HttpLimiterKey(limiterKey)); this.metricContext = broker.getSharedResource(new MetricContextFactory<>(), new MetricContextKey()); this.sendTimer = this.metricContext.timer(limiterKey); } catch (NotConfiguredException e) { log.error ("Limiter cannot be initialized due to exception " + ExceptionUtils.getFullStackTrace(e)); throw new RuntimeException(e); } }
String st = ExceptionUtils.getFullStackTrace( e ); if ( useXML ) { out.println( new WebResult( WebResult.STRING_ERROR, st ).getXML() );
@Test public void fail_with_IAE_when_measure_has_no_value() throws Exception { DefaultMeasure<Integer> measure = new DefaultMeasure<Integer>().forMetric(CoreMetrics.LINES_TO_COVER); when(measureCache.byComponentKey(inputFile.key())).thenReturn(Collections.singletonList(measure)); try { publisher.publish(writer); fail(); } catch (RuntimeException e) { assertThat(ExceptionUtils.getFullStackTrace(e)).contains("Measure on metric 'lines_to_cover' and component 'foo:src/Foo.php' has no value, but it's not allowed"); } }
log.error("{} cannot be verified because of {}", dataset.datasetRoot(), ExceptionUtils.getFullStackTrace(e)); return new Result(false, e.toString());