org.apache.hadoop.chukwa.datacollection.adaptor
Interface Adaptor

All Known Implementing Classes:
CharFileTailingAdaptorUTF8, CharFileTailingAdaptorUTF8NewLineEscaped, ConstRateAdaptor, ExecAdaptor, FileAdaptor, FileTailingAdaptor, MaxRateSender

public interface Adaptor

An adaptor is a component that runs within the Local Agent, producing chunks of monitoring data. An adaptor can, but need not, have an associated thread. If an adaptor lacks a thread, it needs to arrange some mechanism to periodically get control and send reports such as a callback somewhere. Adaptors must be able to stop and resume without losing data, using a byte offset in the stream. If an adaptor crashes at byte offset n, and is restarted at byte offset k, with k < n, it is allowed to send different values for bytes k through n the second time around. However, the stream must still be parseable, assuming that bytes 0-k come from the first run,and bytes k - n come from the second.


Method Summary
 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
 

Method Detail

start

void start(long adaptorID,
           String type,
           String status,
           long offset,
           ChunkReceiver dest)
           throws AdaptorException
Start this adaptor

Parameters:
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

getCurrentStatus

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

Returns:
the adaptor state as a string
Throws:
AdaptorException

getType

String getType()

getStreamName

String getStreamName()
Return the stream name

Returns:
Stream name as a string

shutdown

long shutdown()
              throws AdaptorException
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.

Returns:
the logical offset at which the adaptor stops
Throws:
AdaptorException

hardStop

void hardStop()
              throws AdaptorException
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.

Throws:
AdaptorException


Copyright © ${year} The Apache Software Foundation