Package org.apache.storm.hdfs.common
Class AbstractHDFSWriter
- java.lang.Object
-
- org.apache.storm.hdfs.common.AbstractHDFSWriter
-
- All Implemented Interfaces:
Writer
- Direct Known Subclasses:
AvroGenericRecordHDFSWriter,HDFSWriter,SequenceFileWriter
public abstract class AbstractHDFSWriter extends Object implements Writer
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.hadoop.fs.PathfilePathprotected longlastUsedTimeprotected booleanneedsRotationprotected longoffsetprotected FileRotationPolicyrotationPolicy
-
Constructor Summary
Constructors Constructor Description AbstractHDFSWriter(FileRotationPolicy policy, org.apache.hadoop.fs.Path path)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclose()protected abstract voiddoClose()protected abstract voiddoSync()protected abstract voiddoWrite(Tuple tuple)org.apache.hadoop.fs.PathgetFilePath()booleanneedsRotation()voidsync()longwrite(Tuple tuple)
-
-
-
Field Detail
-
filePath
protected final org.apache.hadoop.fs.Path filePath
-
rotationPolicy
protected final FileRotationPolicy rotationPolicy
-
lastUsedTime
protected long lastUsedTime
-
offset
protected long offset
-
needsRotation
protected boolean needsRotation
-
-
Constructor Detail
-
AbstractHDFSWriter
public AbstractHDFSWriter(FileRotationPolicy policy, org.apache.hadoop.fs.Path path)
-
-
Method Detail
-
write
public final long write(Tuple tuple) throws IOException
- Specified by:
writein interfaceWriter- Throws:
IOException
-
sync
public final void sync() throws IOException- Specified by:
syncin interfaceWriter- Throws:
IOException
-
close
public final void close() throws IOException- Specified by:
closein interfaceWriter- Throws:
IOException
-
needsRotation
public boolean needsRotation()
- Specified by:
needsRotationin interfaceWriter
-
getFilePath
public org.apache.hadoop.fs.Path getFilePath()
- Specified by:
getFilePathin interfaceWriter
-
doWrite
protected abstract void doWrite(Tuple tuple) throws IOException
- Throws:
IOException
-
doSync
protected abstract void doSync() throws IOException- Throws:
IOException
-
doClose
protected abstract void doClose() throws IOException- Throws:
IOException
-
-