HADOOP-11969, Sean Busbey tracked down a non-deterministic NullPointerException to an oddity in the Java memory model: When multiple threads trigger the loading of a class at the same time, one of them wins and creates the java.lang.Class instance; the others block during this initialization, but once it is complete they may obtain a reference to the Class which has non-final fields still containing their default (i.e. null) values. This leads to runtime failures that are hard to debug or diagnose. HADOOP-11969 observed that ThreadLocal fields, by their very nature, are very likely to be accessed from multiple threads, and thus the problem is particularly severe there. Consequently, the patch removed all occurrences of the issue in the code base.
The attached patch addresses the issue by adding the missing final modifier in these two cases.