@Test public void testExtractNLM() throws Exception { System.out.println("extractNLM"); InputStream is = this.getClass().getResourceAsStream("/pdf/test1.pdf"); log.debug("Input stream is: {}", is); CermineExtractorServiceImpl instance = new CermineExtractorServiceImpl(); instance.init(); ExtractionResult result = instance.extractNLM(is); assertNotNull(result); assertTrue(result.isSucceeded()); }
@Override public ExtractionResult extractNLM(InputStream is) throws AnalysisException, ServiceException { log.debug("Starting extractNLM task..."); ExtractionResult res = new ExtractionResult(); res.setSubmit(new Date()); log.debug("submitting extractNLM task..."); try { Future<ExtractionResult> future = batchProcessingExecutor.submit(new SimpleExtractionCallable(is, res)); Thread.yield(); log.debug("waiting for extractNLM task..."); res = future.get(); } catch (RejectedExecutionException rje) { throw new ServiceException("Queue size exceeded.", rje); } catch (Exception ex) { log.error("Exception while executing extraction task...", ex); throw new RuntimeException(ex); } log.debug("finished extractNLM task..."); return res; }
CermineExtractorServiceImpl implements CermineExtractorService { @Override public ExtractionResult extractNLM(InputStream is) throws AnalysisException, ServiceException { log.debug("Starting extractNLM task..."); ExtractionResult res = new ExtractionResult(); res.setSubmit(new Date()); log.debug("submitting extractNLM task..."); try { Future<ExtractionResult> future = batchProcessingExecutor.submit(new SimpleExtractionCallable(is, res)); Thread.yield(); log.debug("waiting for extractNLM task..."); res = future.get(); } catch (RejectedExecutionException rje) { throw new ServiceException("Queue size exceeded.", rje); } catch (Exception ex) { log.error("Exception while executing extraction task...", ex); throw new RuntimeException(ex); } log.debug("finished extractNLM task..."); return res; } }
CermineExtractorServiceImpl implements CermineExtractorService { @Override public ExtractionResult extractNLM(InputStream is) throws AnalysisException, ServiceException { log.debug("Starting extractNLM task..."); ExtractionResult res = new ExtractionResult(); res.setSubmit(new Date()); log.debug("submitting extractNLM task..."); try { Future<ExtractionResult> future = batchProcessingExecutor.submit(new SimpleExtractionCallable(is, res)); Thread.yield(); log.debug("waiting for extractNLM task..."); res = future.get(); } catch (RejectedExecutionException rje) { throw new ServiceException("Queue size exceeded.", rje); } catch (Exception ex) { log.error("Exception while executing extraction task...", ex); throw new RuntimeException(ex); } log.debug("finished extractNLM task..."); return res; } CermineExtractorServiceImpl(); }
CermineExtractorServiceImpl implements CermineExtractorService { @Override public ExtractionResult extractNLM(InputStream is) throws AnalysisException, ServiceException { log.debug("Starting extractNLM task..."); ExtractionResult res = new ExtractionResult(); res.setSubmit(new Date()); log.debug("submitting extractNLM task..."); try { Future<ExtractionResult> future = batchProcessingExecutor.submit(new SimpleExtractionCallable(is, res)); Thread.yield(); log.debug("waiting for extractNLM task..."); res = future.get(); } catch (RejectedExecutionException rje) { throw new ServiceException("Queue size exceeded.", rje); } catch (Exception ex) { log.error("Exception while executing extraction task...", ex); throw new RuntimeException(ex); } log.debug("finished extractNLM task..."); return res; } CermineExtractorServiceImpl(); @PostConstruct void init(); int getThreadPoolSize(); void setThreadPoolSize(int threadPoolSize); int getMaxQueueForBatch(); void setMaxQueueForBatch(int maxQueueForBatch); @Override ExtractionResult extractNLM(InputStream is); @Override long initExtractionTask(byte[] pdf, String fileName); }
CermineExtractorServiceImpl implements CermineExtractorService { @Override public ExtractionResult extractNLM(InputStream is) throws AnalysisException, ServiceException { log.debug("Starting extractNLM task..."); ExtractionResult res = new ExtractionResult(); res.setSubmit(new Date()); log.debug("submitting extractNLM task..."); try { Future<ExtractionResult> future = batchProcessingExecutor.submit(new SimpleExtractionCallable(is, res)); Thread.yield(); log.debug("waiting for extractNLM task..."); res = future.get(); } catch (RejectedExecutionException rje) { throw new ServiceException("Queue size exceeded.", rje); } catch (Exception ex) { log.error("Exception while executing extraction task...", ex); throw new RuntimeException(ex); } log.debug("finished extractNLM task..."); return res; } CermineExtractorServiceImpl(); @PostConstruct void init(); int getThreadPoolSize(); void setThreadPoolSize(int threadPoolSize); int getMaxQueueForBatch(); void setMaxQueueForBatch(int maxQueueForBatch); @Override ExtractionResult extractNLM(InputStream is); @Override long initExtractionTask(byte[] pdf, String fileName);  }