}
error = null;
exeResult = ExecuteResult.SUCCESS;
} catch (DeadlockLoserDataAccessException ex) {
error = new LoadException(ExceptionUtils.getFullStackTrace(ex),
DbLoadDumper.dumpEventDatas(splitDatas));
exeResult = ExecuteResult.RETRY;
} catch (DataIntegrityViolationException ex) {
error = new LoadException(ExceptionUtils.getFullStackTrace(ex),
DbLoadDumper.dumpEventDatas(splitDatas));
// if (StringUtils.contains(ex.getMessage(), "ORA-00001")) {
// exeResult = ExecuteResult.RETRY;
// } else {
// exeResult = ExecuteResult.ERROR;
// }
exeResult = ExecuteResult.ERROR;
} catch (RuntimeException ex) {
error = new LoadException(ExceptionUtils.getFullStackTrace(ex),
DbLoadDumper.dumpEventDatas(splitDatas));
exeResult = ExecuteResult.ERROR;
} catch (Throwable ex) {
error = new LoadException(ExceptionUtils.getFullStackTrace(ex),
DbLoadDumper.dumpEventDatas(splitDatas));
exeResult = ExecuteResult.ERROR;
}
if (ExecuteResult.SUCCESS == exeResult) {
allFailedDatas.addAll(failedDatas);// 记录一下异常到all记录中
allProcesedDatas.addAll(processedDatas);
failedDatas.clear();// 清空上一轮的处理
processedDatas.clear();
break; // do next eventData
} else if (ExecuteResult.RETRY == exeResult) {
retryCount = retryCount + 1;// 计数一次
// 出现异常,理论上当前的批次都会失败
processedDatas.clear();
failedDatas.clear();
failedDatas.addAll(splitDatas);
if (retryCount >= retry) {
processFailedDatas(index);// 重试已结束,添加出错记录并退出
throw new LoadException(String.format("execute [%s] retry %s times failed",
context.getIdentity().toString(), retryCount), error);
} else {
try {
int wait = retryCount * retryWait;
wait = (wait < retryWait) ? retryWait : wait;
Thread.sleep(wait);
} catch (InterruptedException ex) {
Thread.interrupted();
processFailedDatas(index);// 局部处理出错了
throw new LoadException(ex);
}
}
} else {
// 出现异常,理论上当前的批次都会失败
processedDatas.clear();