public class AsyncItemWriter<T> extends java.lang.Object implements ItemStreamWriter<java.util.concurrent.Future<T>>, org.springframework.beans.factory.InitializingBean
Constructor and Description |
---|
AsyncItemWriter() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet() |
void |
close()
If any resources are needed for the stream to operate they need to be destroyed here.
|
void |
open(ExecutionContext executionContext)
Open the stream for the provided
ExecutionContext . |
void |
setDelegate(ItemWriter<T> delegate) |
void |
update(ExecutionContext executionContext)
Indicates that the execution context provided during open is about to be saved.
|
void |
write(java.util.List<? extends java.util.concurrent.Future<T>> items)
In the processing of the
Future s passed, nulls are not passed to the
delegate since they are considered filtered out by the AsyncItemProcessor 's
delegated ItemProcessor . |
public void afterPropertiesSet() throws java.lang.Exception
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
java.lang.Exception
public void setDelegate(ItemWriter<T> delegate)
delegate
- ItemWriter that does the actual writing of the Future resultspublic void write(java.util.List<? extends java.util.concurrent.Future<T>> items) throws java.lang.Exception
Future
s 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.write
in interface ItemWriter<java.util.concurrent.Future<T>>
items
- Future
s to be unwrapped and passed to the delegatejava.lang.Exception
- The exception returned by the Future if one was thrownpublic void open(ExecutionContext executionContext) throws ItemStreamException
ItemStream
ExecutionContext
.open
in interface ItemStream
executionContext
- current step's ExecutionContext
. Will be the
executionContext from the last run of the step on a restart.ItemStreamException
public void update(ExecutionContext executionContext) throws ItemStreamException
ItemStream
update
in interface ItemStream
executionContext
- to be updatedItemStreamException
public void close() throws ItemStreamException
ItemStream
close
in interface ItemStream
ItemStreamException