MetadataExtractorMapper.java 文件源码

java
阅读 34 收藏 0 点赞 0 评论 0

项目:iis 作者:
/**
 * Processes content input stream. Does not close contentStream.
 * 
 * @param documentId document identifier
 * @param contentStream stream to be processed
 */
protected void processStream(String documentId, InputStream contentStream) throws IOException, InterruptedException {
    currentProgress++;
    if (currentProgress % PROGRESS_LOG_INTERVAL == 0) {
        log.info("metadata extaction progress: " + currentProgress + ", time taken to process "
                + PROGRESS_LOG_INTERVAL + " elements: " + ((System.currentTimeMillis() - intervalTime) / 1000)
                + " secs");
        intervalTime = System.currentTimeMillis();
    }

    log.info("starting processing for id: " + documentId);
    long startTime = System.currentTimeMillis();

    try {
        ContentExtractor extractor = interruptionTimeoutSecs != null ? new ContentExtractor(interruptionTimeoutSecs)
                : new ContentExtractor();
        extractor.setPDF(contentStream);
        handleContent(extractor, documentId);
    } catch (Exception e) {
        log.error((e.getCause() instanceof InvalidPdfException) ? "Invalid PDF file" 
                : "got unexpected exception, just logging", e);
        handleException(e, documentId);
        return;
    }

    handleProcessingTime(System.currentTimeMillis() - startTime, documentId);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号