org.apache.hadoop.chukwa.util
Class ConstRateAdaptor

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

public class ConstRateAdaptor
extends AbstractAdaptor
implements Runnable

Emits chunks at a roughly constant data rate. Chunks are in a very particular format: the output data is verifiable, but sufficiently non-deterministic that two different instances of this adaptor are very likely to have distinct outputs. Each chunk is full of random bytes; the randomness comes from an instance of java.util.Random seeded with the offset xored with the time-of-generation. The time of generation is stored, big-endian, in the first eight bytes of each chunk.


Field Summary
 
Fields inherited from class org.apache.hadoop.chukwa.datacollection.adaptor.AbstractAdaptor
adaptorID, control, dest, type
 
Constructor Summary
ConstRateAdaptor()
           
 
Method Summary
static boolean checkChunk(Chunk chunk)
           
 String getCurrentStatus()
          Return the adaptor's state Should not include class name or byte offset, which are written by caller.
 ChunkImpl nextChunk(int arraySize)
           
 String parseArgs(String bytesPerSecParam)
           
 void run()
           
 long shutdown(AdaptorShutdownPolicy shutdownPolicy)
          Signals this adaptor to come to an orderly stop.
 void start(long offset)
           
 String toString()
           
 
Methods inherited from class org.apache.hadoop.chukwa.datacollection.adaptor.AbstractAdaptor
deregisterAndStop, getType, hardStop, parseArgs, shutdown, start
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConstRateAdaptor

public ConstRateAdaptor()
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(long offset)
           throws AdaptorException
Specified by:
start in class AbstractAdaptor
Throws:
AdaptorException

parseArgs

public String parseArgs(String bytesPerSecParam)
Specified by:
parseArgs in class AbstractAdaptor

run

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

nextChunk

public ChunkImpl nextChunk(int arraySize)

toString

public String toString()
Overrides:
toString in class Object

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

checkChunk

public static boolean checkChunk(Chunk chunk)


Copyright © 2011 Apache Software Foundation. All Rights Reserved.