|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.chukwa.datacollection.adaptor.filetailer.FileTailingAdaptor
public class FileTailingAdaptor
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().
Field Summary | |
---|---|
protected long |
adaptorID
|
protected static org.apache.hadoop.conf.Configuration |
conf
|
static int |
DEFAULT_MAX_READ_SIZE
This is the maximum amount we'll read from any one file before moving on to the next. |
protected long |
fileReadOffset
next PHYSICAL offset to read |
static int |
GRACEFUL_PERIOD
|
static int |
MAX_READ_SIZE
|
static int |
MAX_RETRIES
|
protected RandomAccessFile |
reader
|
protected String |
type
|
Constructor Summary | |
---|---|
FileTailingAdaptor()
|
Method Summary | |
---|---|
protected int |
extractRecords(ChunkReceiver eq,
long buffOffsetInFile,
byte[] buf)
Extract records from a byte sequence |
String |
getCurrentStatus()
Return the adaptor's state Should not include class name, datatype or byte offset, which are written by caller. |
String |
getStreamName()
Return the stream name |
String |
getType()
|
void |
hardStop()
Stop tailing the file, effective immediately. |
long |
shutdown()
Do one last tail, and then stop |
void |
start(long adaptorID,
String type,
String params,
long bytes,
ChunkReceiver dest)
Start this adaptor |
boolean |
tailFile(ChunkReceiver eq)
Looks at the tail of the associated file, adds some of it to event queue This method is not thread safe. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_MAX_READ_SIZE
public static int MAX_READ_SIZE
public static int MAX_RETRIES
public static int GRACEFUL_PERIOD
protected static org.apache.hadoop.conf.Configuration conf
protected long fileReadOffset
protected String type
protected RandomAccessFile reader
protected long adaptorID
Constructor Detail |
---|
public FileTailingAdaptor()
Method Detail |
---|
public void start(long adaptorID, String type, String params, long bytes, ChunkReceiver dest)
Adaptor
start
in interface Adaptor
type
- the application type, who is starting this adaptorparams
- the status string to use for configuration.bytes
- the stream offset of the first byte sent by this adaptorpublic long shutdown() throws AdaptorException
shutdown
in interface Adaptor
AdaptorException
Adaptor.shutdown()
public void hardStop() throws AdaptorException
hardStop
in interface Adaptor
AdaptorException
public String getCurrentStatus()
Adaptor
getCurrentStatus
in interface Adaptor
Adaptor.getCurrentStatus()
public String toString()
toString
in class Object
public String getStreamName()
Adaptor
getStreamName
in interface Adaptor
public boolean tailFile(ChunkReceiver eq) throws InterruptedException
eq
- the queue to write Chunks into
InterruptedException
protected int extractRecords(ChunkReceiver eq, long buffOffsetInFile, byte[] buf) throws InterruptedException
eq
- the queue to stick the new chunk[s] inbuffOffsetInFile
- the byte offset in the stream at which buf[] beginsbuf
- the byte buffer to extract records from
InterruptedException
public String getType()
getType
in interface Adaptor
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |