org.apache.hadoop.chukwa.datacollection.writer
Class SocketTeeWriter

java.lang.Object
  extended by org.apache.hadoop.chukwa.datacollection.writer.PipelineableWriter
      extended by org.apache.hadoop.chukwa.datacollection.writer.SocketTeeWriter
All Implemented Interfaces:
ChukwaWriter

public class SocketTeeWriter
extends PipelineableWriter

Effectively a "Tee" in the writer pipeline. Accepts incoming connections on port specified by chukwaCollector.tee.port. Defaults to 9094 Protocol is as follows: Client ---> TeeWriter "RAW | WRITABLE " as per DumpChunks. TeeWriter ---> Client "OK\n" In RAW mode TeeWriter ---> Client (length(int) byte[length])* An indefinite sequence of length, followed by byte array. In Writable mode TeeWriter ---> Client (Chunk serialized as Writable)* An indefinite sequence of serialized chunks In English: clients should connect and say either "RAW " or "WRITABLE " followed by a filter. (Note that the keyword is followed by exactly one space.) They'll then receive either a sequence of byte arrays or of writable-serialized. Option chukwaCollector.tee.keepalive controls using TCP keepalive. Defaults to true.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.hadoop.chukwa.datacollection.writer.ChukwaWriter
ChukwaWriter.COMMIT_PENDING, ChukwaWriter.CommitStatus
 
Field Summary
static String ASCII_HEADER
           
static int DEFAULT_PORT
           
static String RAW
           
static String WRITABLE
           
 
Fields inherited from interface org.apache.hadoop.chukwa.datacollection.writer.ChukwaWriter
COMMIT_FAIL, COMMIT_OK
 
Constructor Summary
SocketTeeWriter()
           
 
Method Summary
 ChukwaWriter.CommitStatus add(List<Chunk> chunks)
          Called repeatedly with data that should be serialized.
 void close()
          Called once, indicating that the writer should close files and prepare to exit.
 void init(org.apache.hadoop.conf.Configuration c)
          Called once to initialize this writer.
 void setNextStage(ChukwaWriter next)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WRITABLE

public static final String WRITABLE
See Also:
Constant Field Values

RAW

public static final String RAW
See Also:
Constant Field Values

ASCII_HEADER

public static final String ASCII_HEADER
See Also:
Constant Field Values

DEFAULT_PORT

public static final int DEFAULT_PORT
See Also:
Constant Field Values
Constructor Detail

SocketTeeWriter

public SocketTeeWriter()
Method Detail

setNextStage

public void setNextStage(ChukwaWriter next)
Overrides:
setNextStage in class PipelineableWriter

add

public ChukwaWriter.CommitStatus add(List<Chunk> chunks)
                              throws WriterException
Description copied from interface: ChukwaWriter
Called repeatedly with data that should be serialized. Subclasses may assume that init() will be called before any calls to add(), and that add() won't be called after close().

Specified by:
add in interface ChukwaWriter
Overrides:
add in class PipelineableWriter
Returns:
Throws:
WriterException

close

public void close()
           throws WriterException
Description copied from interface: ChukwaWriter
Called once, indicating that the writer should close files and prepare to exit.

Throws:
WriterException

init

public void init(org.apache.hadoop.conf.Configuration c)
          throws WriterException
Description copied from interface: ChukwaWriter
Called once to initialize this writer.

Throws:
WriterException


Copyright © ${year} The Apache Software Foundation