if (DocumentProcessor.Progress.LATER.equals(progress)) { later.add(new Tuple2<>(progress, processing)); } else if (DocumentProcessor.Progress.DONE.equals(progress)) { processingsDone.add(processing); } else if (DocumentProcessor.Progress.FAILED.equals(progress)) { logProcessingFailure(processing, null); requestContext.processingFailed(RequestContext.ErrorCode.ERROR_PROCESSING_FAILURE, progress.getReason().orElse("Document processing failed.")); return progress; } else if (DocumentProcessor.Progress.PERMANENT_FAILURE.equals(progress)) { logProcessingFailure(processing, null); requestContext.processingFailed(RequestContext.ErrorCode.ERROR_PROCESSING_FAILURE, progress.getReason().orElse("Document processing failed.")); return progress;
if (DocumentProcessor.Progress.DONE.equals(progress)) { } else if (DocumentProcessor.Progress.FAILED.equals(progress)) { processingFailed(processing, processing + " failed at " + processing.callStack().getLastPopped(), null); return true; } else if (DocumentProcessor.Progress.PERMANENT_FAILURE.equals(progress)) { processingFailed(processing, processing + " failed PERMANENTLY at " + processing.callStack().getLastPopped() + ", disabling processing service.", null);
@Override public void run() { try { try { processings.addAll(requestContext.getProcessings()); } catch (Exception e) { //deserialization failed: log.log(LogLevel.WARNING, "Deserialization of message failed.", e); requestContext.processingFailed(e); return; } DocprocExecutor executor = service.getExecutor(); DocumentProcessor.Progress progress = process(executor); if (DocumentProcessor.Progress.LATER.equals(progress) && !processings.isEmpty()) { DocumentProcessor.LaterProgress laterProgress = (DocumentProcessor.LaterProgress) progress; docprocHandler.submit(this, laterProgress.getDelay()); } } catch (Error error) { try { log.log(LogLevel.FATAL, Exceptions.toMessageString(error), error); } catch (Throwable t) { // do nothing } finally { Runtime.getRuntime().halt(1); } } }
public Progress withReason(String reason) { return new Progress(this.name, reason); }