boolean jobCountDecremented = false;
String archiveFormat = getArchiveFormat(results);
if (archiveFormat != null) {
results.setArchive(true);
ResourceId id = resultHandler.handle(results);
jobCounter.incrementPostProcess();
RequestIdentifier identifier = request.getIdentifier();
identifier.setResourceId(id);
if (identifier.getAncestorId() == null) {
identifier.setAncestorId(id.getId());
}
submissionQueue.add(request.getIdentifier());
jobCounter.decrement();
jobCountDecremented = true;
try {
ArchiveHandler handler = archiveHandlerFactory.getHandler(archiveFormat);
handler.handle(request);
// CHECKSTYLE:OFF
} catch (Exception e) {
// CHECKSTYLE:ON
String causeMessage = "";
if (e.getCause() != null) {
causeMessage = e.getCause().getMessage();
}
final String message = String.format(ARCHIVE_ERROR,
archiveFormat, request.getIdentifier().getUri().toString(), e.getMessage(), causeMessage);
log.warn(message);
resultHandler.handleError(new IdentificationException(
request, IdentificationErrorType.OTHER, e));
} finally {
submissionQueue.remove(request.getIdentifier());
jobCounter.decrementPostProcess();
}
} else {
ResourceId id = resultHandler.handle(results);
request.getIdentifier().setNodeId(id.getId());
}
return jobCountDecremented;
}