segmentio/analytics-java — pull request #11 by jbcpollak (2013-12-30 17:07:11+00:00)
Title: Requester enhancements - timeouts, unit tests, and an Async Requester

Hello,

I believe I've identified a serious problem with the BlockingRequester. Some timeout parameters aren't set, which means an Http Request can hang forever, meaning future events get lost, since the library never recovers from this state.

This patch introduces a fix to set these timeouts, and a unit test to verify they actually work.

I also wrote an optional AsynchronousRequester, which uses Java Futures and would solve the problem with another layer, but allowing up to three (configurable) requests to run simultaneously. The Async requester is a wrapper around the BlockingRequester; in the future it might make sense to invert that and have the BlockingRequester be a wrapper around an asynchronous implementation.

There are a few throw away commits as I tried to coax my Jenkins build into passing all the tests, for some reason the AliasTest (unchanged by my modifications) passed on my development machine but not in Jenkins, when I added some logging the problem went away.