protected void detectStreamInReader() { if (streamIsReader) { if (!concurrent()) { chunkMonitor.setItemReader(getReader()); } else { logger.warn("Asynchronous TaskExecutor detected with ItemStream reader. This is probably an error, " + "and may lead to incorrect restart data being stored."); } } }
@Test(expected = ItemStreamException.class) public void testOpenWithErrorInReader() { monitor.setItemReader(new ItemReader<String>() { @Override public String read() throws Exception, UnexpectedInputException, ParseException { throw new IllegalStateException("Expected"); } }); ExecutionContext executionContext = new ExecutionContext(); executionContext.putInt(ChunkMonitor.class.getName() + ".OFFSET", 2); monitor.open(executionContext); }
@Before public void setUp() { monitor.setItemReader(new ItemReader<String>() { @Override public String read() throws Exception, UnexpectedInputException, ParseException { return "" + (count++); } }); monitor.registerItemStream(new ItemStreamSupport() { @Override public void close() { super.close(); closed = true; } }); monitor.setChunkSize(CHUNK_SIZE); }
@Test public void testOpenWithNullReader() { monitor.setItemReader(null); ExecutionContext executionContext = new ExecutionContext(); monitor.open(executionContext); assertEquals(0, monitor.getOffset()); }
@Test public void testUpdateWithNoStream() throws Exception { monitor = new ChunkMonitor(); monitor.setItemReader(new ItemReader<String>() { @Override public String read() throws Exception, UnexpectedInputException, ParseException { return "" + (count++); } }); monitor.setChunkSize(CHUNK_SIZE); monitor.incrementOffset(); ExecutionContext executionContext = new ExecutionContext(); monitor.update(executionContext); assertEquals(0, executionContext.size()); } }
protected void detectStreamInReader() { if (streamIsReader) { if (!concurrent()) { chunkMonitor.setItemReader(getReader()); } else { logger.warn("Asynchronous TaskExecutor detected with ItemStream reader. This is probably an error, " + "and may lead to incorrect restart data being stored."); } } }
protected void detectStreamInReader() { if (streamIsReader) { if (!concurrent()) { chunkMonitor.setItemReader(getReader()); } else { logger.warn("Asynchronous TaskExecutor detected with ItemStream reader. This is probably an error, " + "and may lead to incorrect restart data being stored."); } } }
protected void detectStreamInReader() { if (streamIsReader) { if (!concurrent()) { chunkMonitor.setItemReader(getReader()); } else { logger.warn("Asynchronous TaskExecutor detected with ItemStream reader. This is probably an error, " + "and may lead to incorrect restart data being stored."); } } }
boolean concurrent = taskExecutor != null && !(taskExecutor instanceof SyncTaskExecutor); if (!concurrent) { chunkMonitor.setItemReader(itemReader);