@Override public void close() throws ItemStreamException { super.close(); resourceIndex = 1; currentResourceItemCount = 0; if (opened) { delegate.close(); } }
@Override public void write(List<? extends T> items) throws Exception { if (!opened) { File file = setResourceToDelegate(); // create only if write is called file.createNewFile(); Assert.state(file.canWrite(), "Output resource " + file.getAbsolutePath() + " must be writable"); delegate.open(new ExecutionContext()); opened = true; } delegate.write(items); currentResourceItemCount += items.size(); if (currentResourceItemCount >= itemCountLimitPerResource) { delegate.close(); resourceIndex++; currentResourceItemCount = 0; setResourceToDelegate(); opened = false; } }
@Override public void close() throws ItemStreamException { delegate.close(); initialized = false; }
@Override protected void doClose() throws Exception { resource = null; setCurrentItemIndex(0); if (opened) { delegate.close(); opened = false; LOGGER.trace("Stream is closed"); } }
@Override public void close() throws ItemStreamException { super.close(); resourceIndex = 1; currentResourceItemCount = 0; if (opened) { delegate.close(); } }
private void writeAll(List<? extends T> items) throws Exception { try { writer.open(executionContext); writer.write(items); LOGGER.debug("Written {} items", items.size()); } finally { writer.close(); } }
@Override public void write(List<? extends T> items) throws Exception { if (!opened) { File file = setResourceToDelegate(); // create only if write is called file.createNewFile(); Assert.state(file.canWrite(), "Output resource " + file.getAbsolutePath() + " must be writable"); delegate.open(new ExecutionContext()); opened = true; } delegate.write(items); currentResourceItemCount += items.size(); if (currentResourceItemCount >= itemCountLimitPerResource) { delegate.close(); resourceIndex++; currentResourceItemCount = 0; setResourceToDelegate(); opened = false; } }
delegate.close(); delegate.update(executionContext); opened = false;