mongodb/mongo-hadoop — pull request #116 by adq (2014-10-14 22:51:42+00:00)
Title: Remove static modifier from BSON encoder/decoder to allow running multithreaded

Hi, currently if you use the mongodb hadoop core integration with Spark, you end up with a nasty InvalidStateException from the BSON decoder. See reports:

http://stackoverflow.com/questions/25254934/illegal-state-exception-mongo-hadoop-and-spark
http://stackoverflow.com/questions/25226515/exception-while-connecting-to-mongodb-in-spark
https://jira.mongodb.org/browse/HADOOP-154

This is because your BSON encoder/decoders are static in the MongoInputSplit.java. When Spark runs multithreaded, these get shared between all class instances in the same process, hence it has "issues" as all the threads are attempting to use the same decoder encoder at once.

Removing the static field modifier fixes it.