org.springframework.data.hadoop.fs
Class HdfsItemWriter<T>
java.lang.Object
org.springframework.data.hadoop.fs.HdfsItemWriter<T>
- All Implemented Interfaces:
- ItemStream, ItemStreamWriter<T>, ItemWriter<T>
public class HdfsItemWriter<T>
- extends Object
- implements ItemStreamWriter<T>
An 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
.
This ItemWriter
is not thread-safe.
- Author:
- Michael Minella
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
HdfsItemWriter
public HdfsItemWriter(FileSystem fileSystem,
Serializer<T> itemSerializer,
String fileName)
- Constructor
- Parameters:
fileSystem
- - HDFS FileSystem
referenceitemSerializer
- - Strategy for serializing itemsfileName
- - Name of the file to be written to
doWrite
protected void doWrite(List<? extends T> items)
- Performs the actual write to the store via the template.
This can be overridden by a subclass if necessary.
- Parameters:
items
- the list of items to be persisted.
open
public void open(ExecutionContext executionContext)
throws ItemStreamException
- Specified by:
open
in interface ItemStream
- Throws:
ItemStreamException
update
public void update(ExecutionContext executionContext)
throws ItemStreamException
- Specified by:
update
in interface ItemStream
- Throws:
ItemStreamException
write
public void write(List<? extends T> items)
throws Exception
- Specified by:
write
in interface ItemWriter<T>
- Throws:
Exception
close
public void close()
- Specified by:
close
in interface ItemStream