org.apache.hadoop.chukwa.datacollection.adaptor
Class DirTailingAdaptor

java.lang.Object
  extended by org.apache.hadoop.chukwa.datacollection.adaptor.AbstractAdaptor
      extended by org.apache.hadoop.chukwa.datacollection.adaptor.DirTailingAdaptor
All Implemented Interfaces:
Runnable, Adaptor

public class DirTailingAdaptor
extends AbstractAdaptor
implements Runnable

Explore a whole directory hierarchy, looking for files to tail. DirTailingAdaptor will not try to start tailing a file more than once, if the file hasn't been modified in the interim. Offset param is used to track last finished scan. Mandatory first parameter is a directory. Mandatory second parameter is the name of an adaptor to start. If the specified directory does not exist, the DirTailer will continue running, and will start tailing if the directory is later created.


Field Summary
 
Fields inherited from class org.apache.hadoop.chukwa.datacollection.adaptor.AbstractAdaptor
adaptorID, control, dest, type
 
Constructor Summary
DirTailingAdaptor()
           
 
Method Summary
 String getCurrentStatus()
          Return the adaptor's state Should not include class name or byte offset, which are written by caller.
 void hardStop()
          Deprecated. 
 String parseArgs(String status)
          Parse args, return stream name.
 void run()
           
 long shutdown()
          Deprecated. 
 long shutdown(AdaptorShutdownPolicy shutdownPolicy)
          Signals this adaptor to come to an orderly stop.
 void start(long offset)
           
 
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, toString, wait, wait, wait
 

Constructor Detail

DirTailingAdaptor

public DirTailingAdaptor()
Method Detail

start

public void start(long offset)
           throws AdaptorException
Specified by:
start in class AbstractAdaptor
Throws:
AdaptorException

run

public void run()
Specified by:
run in interface Runnable

getCurrentStatus

public String getCurrentStatus()
Description copied from interface: Adaptor
Return the adaptor's state Should not include class name or byte offset, which are written by caller. The datatype should, however, be written by this method.

Specified by:
getCurrentStatus in interface Adaptor
Returns:
the adaptor state as a string

parseArgs

public String parseArgs(String status)
Description copied from interface: Adaptor
Parse args, return stream name. Do not start running. Return the stream name, given params. The stream name is the part of the Adaptor status that's used to determine uniqueness.

Specified by:
parseArgs in interface Adaptor
Returns:
Stream name as a string, null if params are malformed

shutdown

@Deprecated
public long shutdown()
              throws AdaptorException
Deprecated. 

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. This method is synchronous up to 60 seconds

Specified by:
shutdown in interface Adaptor
Returns:
the logical offset at which the adaptor stops
Throws:
AdaptorException

hardStop

@Deprecated
public void hardStop()
              throws AdaptorException
Deprecated. 

Description copied from interface: Adaptor
Signals this adaptor to come to an abrupt stop, as quickly as it can. The use case here is "Whups, I didn't mean to start that adaptor tailing a gigabyte file, stop it now". Adaptors might need to do something nontrivial here, e.g., in the case in which they have registered periodic timer interrupts, or use a shared worker thread from which they need to disengage. This method is synchronous: In other words, after shutdown() returns, no new data should be written.

Specified by:
hardStop in interface Adaptor
Throws:
AdaptorException

shutdown

public long shutdown(AdaptorShutdownPolicy shutdownPolicy)
              throws AdaptorException
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
Returns:
the logical offset at which the adaptor was when the method return
Throws:
AdaptorException


Copyright © ${year} The Apache Software Foundation