I have a mapper class (extended from mapreduce.Mapper), where setup reports to an outside resource. I want to make sure that most of the time when the task fails or is killed, a specific chunk of cleanup code is executed. If it's a system or framework error, then I'm alright with a resource leak. I just don't want task preemption or trivial bugs in the map code to leave loose ends, since those happen pretty often.
I tried to achieve this by overriding the run method, and wrapping the call to super.run(context) in a try/finally block. However, it doesn't seem like the finally block is actually executed when I kill a specific task. Does anyone know how the task is told to quit when it is killed? I assumed it was by raising an InterruptedException, which should trigger the finally block, but that doesn't seem to be the case. Thanks, Chase
