public static void close() {
    MapredContext context = contexts.get();
    if (context != null) {
      context.closeAll();
    }
    contexts.remove();
  }
Runtime context of MapredTask providing additional information to GenericUDF
ql/src/java/org/apache/hadoop/hive/ql/exec/MapredContext.java