org.apache.hadoop.chukwa.datacollection.adaptor.filetailer
Class FileTailingAdaptor

java.lang.Object
  extended by org.apache.hadoop.chukwa.datacollection.adaptor.AbstractAdaptor
      extended by org.apache.hadoop.chukwa.datacollection.adaptor.filetailer.LWFTAdaptor
          extended by 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().


Field Summary
static int GRACEFUL_PERIOD
           
static int MAX_RETRIES
           
protected  RandomAccessFile reader
           
 
Fields inherited from class org.apache.hadoop.chukwa.datacollection.adaptor.filetailer.LWFTAdaptor
conf, DEFAULT_MAX_READ_SIZE, fileReadOffset, MAX_READ_SIZE, MAX_READ_SIZE_OPT, offsetOfFirstByte, tailer
 
Fields inherited from class org.apache.hadoop.chukwa.datacollection.adaptor.AbstractAdaptor
adaptorID, control, dest, type
 
Constructor Summary
FileTailingAdaptor()
           
 
Method Summary
 void hardStop()
          Deprecated. 
 long shutdown()
          Deprecated. 
 long shutdown(AdaptorShutdownPolicy shutdownPolicy)
          Signals this adaptor to come to an orderly stop.
 void start(long bytes)
           
 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.
 
Methods inherited from class org.apache.hadoop.chukwa.datacollection.adaptor.filetailer.LWFTAdaptor
extractRecords, getCurrentStatus, getStreamName, parseArgs, slurp, toString
 
Methods inherited from class org.apache.hadoop.chukwa.datacollection.adaptor.AbstractAdaptor
deregisterAndStop, getType, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_RETRIES

public static int MAX_RETRIES

GRACEFUL_PERIOD

public static int GRACEFUL_PERIOD

reader

protected RandomAccessFile reader
Constructor Detail

FileTailingAdaptor

public FileTailingAdaptor()
Method Detail

start

public void start(long bytes)
Overrides:
start in class LWFTAdaptor

shutdown

@Deprecated
public long shutdown()
              throws AdaptorException
Deprecated. 

Do one last tail, and then stop

Specified by:
shutdown in interface Adaptor
Overrides:
shutdown in class LWFTAdaptor
Returns:
the logical offset at which the adaptor stops
Throws:
AdaptorException
See Also:
Adaptor.shutdown()

hardStop

@Deprecated
public void hardStop()
              throws AdaptorException
Deprecated. 

Stop tailing the file, effective immediately.

Specified by:
hardStop in interface Adaptor
Overrides:
hardStop in class LWFTAdaptor
Throws:
AdaptorException

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(ChunkReceiver eq)
                 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 © ${year} The Apache Software Foundation