Tabnine Logo
org.springframework.batch.core.step.item
Code IndexAdd Tabnine to your IDE (free)

How to use org.springframework.batch.core.step.item

Best Java code snippets using org.springframework.batch.core.step.item (Showing top 20 results out of 315)

origin: spring-projects/spring-batch

@Override
protected Chunk<O> getAdjustedOutputs(Chunk<I> inputs, Chunk<O> outputs) {
  @SuppressWarnings("unchecked")
  UserData<O> data = (UserData<O>) inputs.getUserData();
  Chunk<O> previous = data.getOutputs();
  Chunk<O> next = new Chunk<>(outputs.getItems(), previous.getSkips());
  next.setBusy(previous.isBusy());
  // Remember for next time if there are skips accumulating
  data.setOutputs(next);
  return next;
}
origin: spring-projects/spring-batch

public <T, E extends Throwable> T execute(RetryCallback<T, E> retryCallback, Collection<RetryState> states) throws E,
Exception {
  RetryState batchState = new BatchRetryState(states);
  return delegate.execute(retryCallback, batchState);
}
origin: spring-projects/spring-batch

/**
 * Overrides the buffering settings in the chunk processor if it is fault tolerant.
 * @param chunkProcessor the chunk processor that is going to be used in the workers
 */
private void setNonBuffering(ChunkProcessor<T> chunkProcessor) {
  if (chunkProcessor instanceof FaultTolerantChunkProcessor<?, ?>) {
    ((FaultTolerantChunkProcessor<?, ?>) chunkProcessor).setBuffering(false);
  }
}
origin: spring-projects/spring-batch

@Override
protected void initializeUserData(Chunk<I> inputs) {
  @SuppressWarnings("unchecked")
  UserData<O> data = (UserData<O>) inputs.getUserData();
  if (data == null) {
    data = new UserData<>();
    inputs.setUserData(data);
    data.setOutputs(new Chunk<>());
  }
  else {
    // BATCH-2663: re-initialize filter count when scanning the chunk
    if (data.scanning()) {
      data.filterCount = 0;
    }
  }
}
origin: spring-projects/spring-batch

/**
 * @param chunk Chunk to recover
 */
private void recover(Chunk<String> chunk) throws Exception {
  for (Chunk<String>.ChunkIterator iterator = chunk.iterator(); iterator.hasNext();) {
    String string = iterator.next();
    try {
      doWrite(Collections.singletonList(string));
    } catch (Exception e) {
      iterator.remove(e);
      throw e;
    }
  }
}
origin: spring-projects/spring-batch

public AlmostStatefulRetryChunkTests(String[] args, int limit) {
  chunk = new Chunk<>();
  for (String string : args) {
    chunk.add(string);
  }
  this.retryLimit = limit;
}
origin: spring-projects/spring-batch

/**
 * Creates a {@link PassThroughItemProcessor} and uses it to create an
 * instance of {@link Tasklet}.
 */
public TestingChunkOrientedTasklet(ItemReader<T> itemReader, ItemProcessor<T, T> itemProcessor, ItemWriter<T> itemWriter,
    RepeatOperations repeatOperations) {
  super(new SimpleChunkProvider<>(itemReader, repeatOperations), new SimpleChunkProcessor<>(
      itemProcessor, itemWriter));
}
origin: spring-projects/spring-batch

public void incrementOffset() {
  ChunkMonitorData data = getData();
  data.offset ++;
  if (data.offset >= data.chunkSize) {
    resetOffset();
  }
}
origin: spring-projects/spring-batch

  @Override
  protected String read(StepContribution contribution, Chunk<String> chunk) throws SkipOverflowException,
  Exception {
    chunk.skip(new RuntimeException("Planned"));
    throw new SkipOverflowException("Overflow");
  }
};
origin: spring-projects/spring-batch

@Override
public Chunk<T> provide(StepContribution contribution) throws Exception {
  return new Chunk<>();
}
origin: spring-projects/spring-batch

/**
 * Register some {@link StepListener}s with the handler. Each will get the
 * callbacks in the order specified at the correct stage.
 *
 * @param listeners list of {@link StepListener}s.
 */
public void setListeners(List<? extends StepListener> listeners) {
  for (StepListener listener : listeners) {
    registerListener(listener);
  }
}
origin: spring-projects/spring-batch

/**
 * Register some {@link StepListener}s with the handler. Each will get the
 * callbacks in the order specified at the correct stage.
 *
 * @param listeners list of {@link StepListener} instances.
 */
public void setListeners(List<? extends StepListener> listeners) {
  for (StepListener listener : listeners) {
    registerListener(listener);
  }
}
origin: spring-projects/spring-batch

@Override
protected int getFilterCount(Chunk<I> inputs, Chunk<O> outputs) {
  @SuppressWarnings("unchecked")
  UserData<O> data = (UserData<O>) inputs.getUserData();
  return data.filterCount;
}
origin: spring-projects/spring-batch

/**
 * Extension point for subclasses that want to store additional data in the
 * inputs. Default just checks if inputs are empty.
 *
 * @param inputs the input chunk
 * @return true if it is empty
 *
 * @see #initializeUserData(Chunk)
 */
protected boolean isComplete(Chunk<I> inputs) {
  return inputs.isEmpty();
}
origin: spring-projects/spring-batch

private Object getInputKey(I item) {
  if (keyGenerator == null) {
    return item;
  }
  return keyGenerator.getKey(item);
}
origin: spring-projects/spring-batch

/**
 * Get an unmodifiable iterator for the underlying items.
 * @see java.lang.Iterable#iterator()
 */
@Override
public ChunkIterator iterator() {
  return new ChunkIterator(items);
}
origin: spring-projects/spring-batch

public FaultTolerantStepFactoryBeanTests() throws Exception {
  reader = new SkipReaderStub<>();
  processor = new SkipProcessorStub<>();
  writer = new SkipWriterStub<>();
}
origin: spring-projects/spring-batch

@Before
public void setup() {
  reader.clear();
  writer.clear();
  tasklet.clear();
}
origin: spring-projects/spring-batch

  @Override
  public void write(List<? extends String> items) {
    throw new FatalRuntimeException("Ouch!");
  }
});
origin: spring-projects/spring-batch

public <T, E extends Throwable> T execute(RetryCallback<T, E> retryCallback, RecoveryCallback<T> recoveryCallback,
    Collection<RetryState> states) throws E, Exception {
  RetryState batchState = new BatchRetryState(states);
  return delegate.execute(retryCallback, recoveryCallback, batchState);
}
org.springframework.batch.core.step.item

Most used classes

  • Chunk
    Encapsulation of a list of items to be processed and possibly a list of failed items to be skipped.
  • SimpleChunkProcessor
    Simple implementation of the ChunkProcessor interface that handles basic item writing and processing
  • FaultTolerantChunkProcessor
    FaultTolerant implementation of the ChunkProcessor interface, that allows for skipping or retry of i
  • ChunkOrientedTasklet
    A Tasklet implementing variations on read-process-write item handling.
  • SimpleChunkProvider
    Simple implementation of the ChunkProvider interface that does basic chunk providing from an ItemRea
  • Chunk$ChunkIterator,
  • ChunkMonitor,
  • ChunkProcessor,
  • FaultTolerantChunkProvider,
  • ForceRollbackForWriteSkipException,
  • SimpleRetryExceptionHandler,
  • SkipOverflowException,
  • SkipWrapper,
  • BatchRetryTemplate$BatchRetryContext,
  • BatchRetryTemplate$BatchRetryState,
  • BatchRetryTemplate$InnerRetryTemplate,
  • ChunkMonitor$ChunkMonitorData,
  • ChunkProvider,
  • FaultTolerantChunkProcessor$UserData
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now