org.apache.hadoop.chukwa.datacollection.adaptor.filetailer
Class FileTailingAdaptor
java.lang.Object
org.apache.hadoop.chukwa.datacollection.adaptor.AbstractAdaptor
org.apache.hadoop.chukwa.datacollection.adaptor.filetailer.LWFTAdaptor
org.apache.hadoop.chukwa.datacollection.adaptor.filetailer.FileTailingAdaptor
- All Implemented Interfaces:
- Adaptor
- Direct Known Subclasses:
- CharFileTailingAdaptorUTF8, CharFileTailingAdaptorUTF8NewLineEscaped
public class FileTailingAdaptor
- extends LWFTAdaptor
An adaptor that repeatedly tails a specified file, sending the new bytes.
This class does not split out records, but just sends everything up to end of
file. Subclasses can alter this behavior by overriding extractRecords().
|
Method Summary |
long |
shutdown(AdaptorShutdownPolicy shutdownPolicy)
Signals this adaptor to come to an orderly stop. |
void |
start(long bytes)
|
boolean |
tailFile()
Looks at the tail of the associated file, adds some of it to event queue
This method is not thread safe. |
MAX_RETRIES
public static int MAX_RETRIES
GRACEFUL_PERIOD
public static int GRACEFUL_PERIOD
reader
protected RandomAccessFile reader
FileTailingAdaptor
public FileTailingAdaptor()
start
public void start(long bytes)
- Overrides:
start in class LWFTAdaptor
shutdown
public long shutdown(AdaptorShutdownPolicy shutdownPolicy)
- Description copied from interface:
Adaptor
- Signals this adaptor to come to an orderly stop. The adaptor ought to push
out all the data it can before exiting depending of the shutdown policy
- Specified by:
shutdown in interface Adaptor- Overrides:
shutdown in class LWFTAdaptor
- Returns:
- the logical offset at which the adaptor was when the method return
tailFile
public boolean tailFile()
throws InterruptedException
- Looks at the tail of the associated file, adds some of it to event queue
This method is not thread safe. Returns true if there's more data in the
file
- Overrides:
tailFile in class LWFTAdaptor
- Parameters:
eq - the queue to write Chunks into
- Throws:
InterruptedException
Copyright © 2011 Apache Software Foundation. All Rights Reserved.