public class HdfsItemWriter<T> extends Object implements ItemStreamWriter<T>
ItemWriter implementation used to write the incoming items to
HDFS. Due to the HDFS limitation that files cannot be deleted or modified, the
ability to roll back a file to a previously known state is not possible. This
prevents the ability to restart using this ItemWriter.
ItemWriter is not thread-safe.| Constructor and Description |
|---|
HdfsItemWriter(FileSystem fileSystem,
Serializer<T> itemSerializer,
String fileName)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected void |
doWrite(List<? extends T> items)
Performs the actual write to the store via the template.
|
void |
open(ExecutionContext executionContext) |
void |
update(ExecutionContext executionContext) |
void |
write(List<? extends T> items) |
public HdfsItemWriter(FileSystem fileSystem, Serializer<T> itemSerializer, String fileName)
fileSystem - - HDFS FileSystem referenceitemSerializer - - Strategy for serializing itemsfileName - - Name of the file to be written toprotected void doWrite(List<? extends T> items)
items - the list of items to be persisted.public void open(ExecutionContext executionContext) throws ItemStreamException
open in interface ItemStreamItemStreamExceptionpublic void update(ExecutionContext executionContext) throws ItemStreamException
update in interface ItemStreamItemStreamExceptionpublic void write(List<? extends T> items) throws Exception
write in interface ItemWriter<T>Exceptionpublic void close()
close in interface ItemStream