@Test(timeout = 1000) public void testPerformProcessing_throws_timeout_exception_if_timeout_exceeded() throws Exception { exception.expect(TimeoutException.class); HangingStage processStage = new HangingStage(); processStage.setProcessingTimeout(1); ProcessStageRunner stageRunner = buildStageRunner(processStage); stageRunner.performProcessing(mock(LocalDocument.class)); }
protected void performProcessing(LocalDocument doc) throws Exception { logger.debug("Got new doc '{}' to process.", doc.getID()); try { logger.trace("Waiting for processing of doc '{}'", doc.getID()); processWithTimeout(doc); logger.trace("Processing finished of doc '{}'", doc.getID()); } catch (ExecutionException e) { onException(doc, unwrapExecutionException(e)); return; } catch (TimeoutException e) { onException(doc, e); throw e; } catch (InterruptedException e) { logger.info("Processing was interrupted"); Thread.currentThread().interrupt(); return; } onSuccess(doc); }
ProcessStageRunner { protected void performProcessing(LocalDocument doc) throws Exception { logger.debug("Got new doc '{}' to process.", doc.getID()); try { logger.trace("Waiting for processing of doc '{}'", doc.getID()); processWithTimeout(doc); logger.trace("Processing finished of doc '{}'", doc.getID()); } catch (ExecutionException e) { onException(doc, unwrapExecutionException(e)); return; } catch (TimeoutException e) { onException(doc, e); throw e; } catch (InterruptedException e) { logger.info("Processing was interrupted"); Thread.currentThread().interrupt(); return; } onSuccess(doc); } }
ProcessStageRunner { protected void performProcessing(LocalDocument doc) throws Exception { logger.debug("Got new doc '{}' to process.", doc.getID()); try { logger.trace("Waiting for processing of doc '{}'", doc.getID()); processWithTimeout(doc); logger.trace("Processing finished of doc '{}'", doc.getID()); } catch (ExecutionException e) { onException(doc, unwrapExecutionException(e)); return; } catch (TimeoutException e) { onException(doc, e); throw e; } catch (InterruptedException e) { logger.info("Processing was interrupted"); Thread.currentThread().interrupt(); return; } onSuccess(doc); } ProcessStageRunner(String stageName, AbstractProcessStage stage, RemotePipeline remotePipeline); }
ProcessStageRunner { protected void performProcessing(LocalDocument doc) throws Exception { logger.debug("Got new doc '{}' to process.", doc.getID()); try { logger.trace("Waiting for processing of doc '{}'", doc.getID()); processWithTimeout(doc); logger.trace("Processing finished of doc '{}'", doc.getID()); } catch (ExecutionException e) { onException(doc, unwrapExecutionException(e)); return; } catch (TimeoutException e) { onException(doc, e); throw e; } catch (InterruptedException e) { logger.info("Processing was interrupted"); Thread.currentThread().interrupt(); return; } onSuccess(doc); } ProcessStageRunner(String stageName, AbstractProcessStage stage, RemotePipeline remotePipeline); void shutdownProcessing(); }
ProcessStageRunner { protected void performProcessing(LocalDocument doc) throws Exception { logger.debug("Got new doc '{}' to process.", doc.getID()); try { logger.trace("Waiting for processing of doc '{}'", doc.getID()); processWithTimeout(doc); logger.trace("Processing finished of doc '{}'", doc.getID()); } catch (ExecutionException e) { onException(doc, unwrapExecutionException(e)); return; } catch (TimeoutException e) { onException(doc, e); throw e; } catch (InterruptedException e) { logger.info("Processing was interrupted"); Thread.currentThread().interrupt(); return; } onSuccess(doc); } ProcessStageRunner(String stageName, AbstractProcessStage stage, RemotePipeline remotePipeline); void shutdownProcessing();  }