private void onExecuteFinishedWithRetry(ExecuteResult result, ExecutableContext executableContext) throws ExecuteException { Throwable exception; int nRetry = 0; do { nRetry++; exception = null; try { onExecuteFinished(result, executableContext); } catch (Exception e) { logger.error(nRetry + "th retries for onExecuteFinished fails due to {}", e); if (isMetaDataPersistException(e, 5)) { exception = e; try { Thread.sleep(1000L * (long) Math.pow(4, nRetry)); } catch (InterruptedException e1) { throw new IllegalStateException(e1); } } else { throw e; } } } while (exception != null && nRetry <= executableContext.getConfig().getJobMetadataPersistRetry()); if (exception != null) { handleMetadataPersistException(executableContext, exception); throw new ExecuteException(exception); } }
@Override public final ExecuteResult execute(ExecutableContext executableContext) throws ExecuteException { //print a eye-catching title in log LogTitlePrinter.printTitle(this.getName()); Preconditions.checkArgument(executableContext instanceof DefaultContext); ExecuteResult result; try { onExecuteStart(executableContext); result = doWork(executableContext); } catch (Throwable e) { logger.error("error running Executable", e); onExecuteError(e, executableContext); throw new ExecuteException(e); } onExecuteFinished(result, executableContext); return result; }
private void onExecuteFinishedWithRetry(ExecuteResult result, ExecutableContext executableContext) throws ExecuteException { Throwable exception; int nRetry = 0; do { nRetry++; exception = null; try { onExecuteFinished(result, executableContext); } catch (Exception e) { logger.error(nRetry + "th retries for onExecuteFinished fails due to {}", e); if (isMetaDataPersistException(e, 5)) { exception = e; try { Thread.sleep(1000L * (long) Math.pow(4, nRetry)); } catch (InterruptedException e1) { throw new IllegalStateException(e1); } } else { throw e; } } } while (exception != null && nRetry <= executableContext.getConfig().getJobMetadataPersistRetry()); if (exception != null) { handleMetadataPersistException(executableContext, exception); throw new ExecuteException(exception); } }
@Override public final ExecuteResult execute(ExecutableContext executableContext) throws ExecuteException { //print a eye-catching title in log LogTitlePrinter.printTitle(this.getName()); Preconditions.checkArgument(executableContext instanceof DefaultContext); ExecuteResult result; try { onExecuteStart(executableContext); result = doWork(executableContext); } catch (Throwable e) { logger.error("error running Executable", e); onExecuteError(e, executableContext); throw new ExecuteException(e); } onExecuteFinished(result, executableContext); return result; }