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

java.lang.Object
  extended by org.apache.hadoop.chukwa.inputtools.plugin.ExecPlugin
      extended by org.apache.hadoop.chukwa.datacollection.adaptor.ExecAdaptor
All Implemented Interfaces:
Adaptor, IPlugin

public class ExecAdaptor
extends ExecPlugin
implements Adaptor

Runs a command inside chukwa. Takes as params the interval in seconds at which to run the command, and the path and args to execute. Interval is optional, and defaults to 5 seconds. Example usage: add org.apache.hadoop.chukwa.datacollection.adaptor.ExecAdaptor Ps 2 /bin/ps aux 0


Field Summary
protected  long adaptorID
           
 
Fields inherited from class org.apache.hadoop.chukwa.inputtools.plugin.ExecPlugin
statusKO, statusOK
 
Constructor Summary
ExecAdaptor()
           
 
Method Summary
 String getCmde()
           
 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()
          Signals this adaptor to come to an abrupt stop, as quickly as it can.
 long shutdown()
          Signals this adaptor to come to an orderly stop.
 void start(long adaptorID, String type, String status, long offset, ChunkReceiver dest)
          Start this adaptor
 
Methods inherited from class org.apache.hadoop.chukwa.inputtools.plugin.ExecPlugin
execute, postProcess, stop, waitFor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

adaptorID

protected long adaptorID
Constructor Detail

ExecAdaptor

public ExecAdaptor()
Method Detail

getCurrentStatus

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

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

getStreamName

public String getStreamName()
Description copied from interface: Adaptor
Return the stream name

Specified by:
getStreamName in interface Adaptor
Returns:
Stream name as a string

hardStop

public void hardStop()
              throws AdaptorException
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()
              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. This method is synchronous: In other words, after shutdown() returns, no new data should be written.

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

start

public void start(long adaptorID,
                  String type,
                  String status,
                  long offset,
                  ChunkReceiver dest)
           throws AdaptorException
Description copied from interface: Adaptor
Start this adaptor

Specified by:
start in interface Adaptor
type - the application type, who is starting this adaptor
status - the status string to use for configuration.
offset - the stream offset of the first byte sent by this adaptor
Throws:
AdaptorException

getCmde

public String getCmde()
Specified by:
getCmde in class ExecPlugin

getType

public String getType()
Specified by:
getType in interface Adaptor


Copyright © ${year} The Apache Software Foundation