If for some reason the setup() throws an exception and mTableContext doesn't get initialized, then the parent class's cleanup() won't be invoked. I don't think mTableContext != null should be a precondition of this method. Perhaps just use IOUtils.closeQuietly() so the call to super.cleanup(hadoopContext) is still invoked.