org.apache.hadoop.chukwa.util
Class MaxRateSender

java.lang.Object
  extended by java.lang.Thread
      extended by org.apache.hadoop.chukwa.util.MaxRateSender
All Implemented Interfaces:
Runnable, Adaptor

public class MaxRateSender
extends Thread
implements Adaptor


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
static String ADAPTOR_NAME
           
static int BUFFER_SIZE
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
MaxRateSender()
           
 
Method Summary
 String getCurrentStatus()
          Return the adaptor's state Should not include class name or byte offset, which are written by caller.
 String getType()
           
 void hardStop()
          Signals this adaptor to come to an abrupt stop, as quickly as it can.
 String parseArgs(String s)
          Parse args, return stream name.
 void run()
           
 long shutdown()
          Signals this adaptor to come to an orderly stop.
 long shutdown(AdaptorShutdownPolicy shutdownPolicy)
          Signals this adaptor to come to an orderly stop.
 void start(String adaptorID, String type, long offset, ChunkReceiver dest, AdaptorManager c)
          Start this adaptor
 String toString()
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BUFFER_SIZE

public static final int BUFFER_SIZE
See Also:
Constant Field Values

ADAPTOR_NAME

public static final String ADAPTOR_NAME
See Also:
Constant Field Values
Constructor Detail

MaxRateSender

public MaxRateSender()
Method Detail

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

start

public void start(String adaptorID,
                  String type,
                  long offset,
                  ChunkReceiver dest,
                  AdaptorManager c)
           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
offset - the stream offset of the first byte sent by this adaptor
Throws:
AdaptorException

parseArgs

public String parseArgs(String s)
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

run

public void run()
Specified by:
run in interface Runnable
Overrides:
run in class Thread

toString

public String toString()
Overrides:
toString in class Thread

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 up to 60 seconds

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

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(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
Returns:
the logical offset at which the adaptor was when the method return

getType

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


Copyright © ${year} The Apache Software Foundation