Patch looks mostly good, just a nit that the comment is misleading. Setting 'prev' to null doesn't accomplish much – it's just a local variable that's just about to go out of scope anyway. The comment implies it's important that it is set to null, but it has nothing to do with the issue. The null setting from
MAPREDUCE-6618 was important since those were instance variables that survive the current method.
We can skip the unnecessary null, and the comment should just say it's important to close the previous cluster instance to cleanup resources. IMHO the debug log is overkill, but I'm OK if you want to leave it.