@VisibleForTesting
  void loadHooksFromConf(HookContext.HookType type) {
    Hooks hooks = typeHooks.get(type);
    if (hooks == null) {
      typeHooks.put(type, hooks = new Hooks());
      List hookList = hooks.getHooks();
      HiveConf.ConfVars confVar = type.getConfVar();
      Collection<String> csHooks = conf.getStringCollection(confVar.varname);
      try {
        for (String clzName : csHooks) {
          Class hookCls = Class.forName(clzName.trim(), true, Utilities.getSessionSpecifiedClassLoader());
          if (type.getHookClass().isAssignableFrom(hookCls)) {
            Object hookObj = hookCls.newInstance();
            hookList.add(hookObj);
          } else {
            String message = "The class: " + clzName + " should be the subclass of " + type.getHookClass().getName()
                + ", as the type: " + type + " defined";
            logErrorMessage(message);
            throw new ClassCastException(clzName + " cannot be cast to " + type.getHookClass().getName());
          }
        }
      } catch(Exception e) {
        String message = "Error loading hooks(" + confVar + "): " + HiveStringUtils.stringifyException(e);
        throw new RuntimeException(message, e);
      }
    }
  }
Loads the configured hooks corresponding to the specific hook type.
@param type hook type
ql/src/java/org/apache/hadoop/hive/ql/hooks/HiveHooks.java