@Override protected void close(ExecutionContext ctx) throws Exception { stream.close(); }
@Override protected void open(ExecutionContext ctx) throws Exception { stream.open(ctx); }
/** * Register a single {@link ItemStream} for callbacks to the stream * interface. * * @param stream instance of {@link ItemStream} */ public void registerStream(ItemStream stream) { this.stream.register(stream); }
public void testCloseDoesNotUnregister() { manager.setStreams(new ItemStream[] { new ItemStreamSupport() { @Override public void open(ExecutionContext executionContext) { super.open(executionContext); list.add("bar"); } } }); manager.open(null); manager.close(); manager.open(null); assertEquals(2, list.size()); }
public void testRegisterTwice() { ItemStreamSupport stream = new ItemStreamSupport() { @Override public void open(ExecutionContext executionContext) { super.open(executionContext); list.add("bar"); } }; manager.register(stream); manager.register(stream); manager.open(null); assertEquals(1, list.size()); }
stream.update(stepExecution.getExecutionContext());
stepExecution.getExecutionContext().put(STEP_TYPE_KEY, this.getClass().getName()); stream.update(stepExecution.getExecutionContext()); getJobRepository().updateExecutionContext(stepExecution);
@Override public void update(ExecutionContext executionContext) throws ItemStreamException { super.update(executionContext); if (streamsRegistered) { ChunkMonitorData data = getData(); if (data.offset == 0) { // Only call the underlying update method if we are on a chunk // boundary stream.update(executionContext); executionContext.remove(getExecutionContextKey(OFFSET)); } else { executionContext.putInt(getExecutionContextKey(OFFSET), data.offset); } } }
/** * @param stream the stream to set */ public void registerItemStream(ItemStream stream) { streamsRegistered = true; this.stream.register(stream); }
@Override public void close() throws ItemStreamException { super.close(); holder.set(null); if (streamsRegistered) { stream.close(); } }
@Override public void open(ExecutionContext executionContext) throws ItemStreamException { super.open(executionContext); if (streamsRegistered) { stream.open(executionContext); ChunkMonitorData data = new ChunkMonitorData(executionContext.getInt(getExecutionContextKey(OFFSET), 0), 0); holder.set(data); if (reader == null) { logger.warn("No ItemReader set (must be concurrent step), so ignoring offset data."); return; } for (int i = 0; i < data.offset; i++) { try { reader.read(); } catch (Exception e) { throw new ItemStreamException("Could not position reader with offset: " + data.offset, e); } } resetOffset(); } }
public void update(ExecutionContext executionContext) throws ItemStreamException { if (streamsRegistered) { ChunkMonitorData data = getData(); if (data.offset == 0) { // Only call the underlying update method if we are on a chunk // boundary stream.update(executionContext); } else { executionContext.putInt(OFFSET, data.offset); } } }
/** * Register a single {@link ItemStream} for callbacks to the stream * interface. * * @param stream */ public void registerStream(ItemStream stream) { this.stream.register(stream); }
@Override protected void close(ExecutionContext ctx) throws Exception { stream.close(); }
@Override protected void open(ExecutionContext ctx) throws Exception { stream.open(ctx); }
stream.update(stepExecution.getExecutionContext());
/** * @param stream the stream to set */ public void registerItemStream(ItemStream stream) { streamsRegistered = true; this.stream.register(stream); }