org.apache.hadoop.chukwa.util
Class ConstRateAdaptor
java.lang.Object
org.apache.hadoop.chukwa.datacollection.adaptor.AbstractAdaptor
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.
ConstRateAdaptor
public ConstRateAdaptor()
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 © ${year} The Apache Software Foundation