Review Board 1.7.22

FLUME-1037: Netcat source should create one event per newline

Review Request #4497 - Created March 27, 2012 and submitted

Mike Percy
The NetcatSource does not create one event per newline. Instead, it creates one event per TCP session.

I have addressed multiple issues with NetcatSource in this patch:

1. Properly process a new event per newline.
2. Enforce a maximum length per line, to ensure clients cannot run the server out of memory. (This is now configurable; the default is 512 characters.)
3. Properly flush responses to the client.
4. Increment counters for successful processing and failure.
5. Use shutdownNow() when shutting down the server, otherwise an open client connection will cause the server to hang on shutdown.
6. Made the inner classes of NetcatSource private; I believe making them public was unintentional.
7. Corrected unit test so it now sends a newline with each request. Also now checks for "OK" response from server.
8. Attempting to sneak in a minor fix for the EventHelper.dumpEvent() method into this patch, since I'm testing with LoggerSink and it's bugging me when it throws an exception on a zero-length body.
Unit tests pass. Did a bunch of manual testing using the nc tool with a Netcat source and a Logger sink.
Review request changed
Updated (March 29, 2012, 1:25 a.m.)
Separated the config constants into their own class per Arvind.
Ship it!
Posted (March 29, 2012, 2:08 a.m.)