Class AsyncItemWriter<T>

java.lang.Object
org.springframework.batch.integration.async.AsyncItemWriter<T>
All Implemented Interfaces:
org.springframework.batch.item.ItemStream, org.springframework.batch.item.ItemStreamWriter<Future<T>>, org.springframework.batch.item.ItemWriter<Future<T>>, org.springframework.beans.factory.InitializingBean

public class AsyncItemWriter<T> extends Object implements org.springframework.batch.item.ItemStreamWriter<Future<T>>, org.springframework.beans.factory.InitializingBean
  • Constructor Details

    • AsyncItemWriter

      public AsyncItemWriter()
  • Method Details

    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Throws:
      Exception
    • setDelegate

      public void setDelegate(org.springframework.batch.item.ItemWriter<T> delegate)
      Parameters:
      delegate - ItemWriter that does the actual writing of the Future results
    • write

      public void write(org.springframework.batch.item.Chunk<? extends Future<T>> items) throws Exception
      In the processing of the Futures passed, nulls are not passed to the delegate since they are considered filtered out by the AsyncItemProcessor's delegated ItemProcessor. If the unwrapping of the Future results in an ExecutionException, that will be unwrapped and the cause will be thrown.
      Specified by:
      write in interface org.springframework.batch.item.ItemWriter<T>
      Parameters:
      items - Futures to be unwrapped and passed to the delegate
      Throws:
      Exception - The exception returned by the Future if one was thrown
    • open

      public void open(org.springframework.batch.item.ExecutionContext executionContext) throws org.springframework.batch.item.ItemStreamException
      Specified by:
      open in interface org.springframework.batch.item.ItemStream
      Throws:
      org.springframework.batch.item.ItemStreamException
    • update

      public void update(org.springframework.batch.item.ExecutionContext executionContext) throws org.springframework.batch.item.ItemStreamException
      Specified by:
      update in interface org.springframework.batch.item.ItemStream
      Throws:
      org.springframework.batch.item.ItemStreamException
    • close

      public void close() throws org.springframework.batch.item.ItemStreamException
      Specified by:
      close in interface org.springframework.batch.item.ItemStream
      Throws:
      org.springframework.batch.item.ItemStreamException