Update example for Hadoop 2.2 and fix a race condition

I have 4 small patches that were required to get the example running against the GA release of Hadoop 2.2.0 on Ubuntu 12.04.