/** * @param resetPerfLogger * @return Tries to return an instance of the class whose name is configured in * hive.exec.perf.logger, but if it can't it just returns an instance of the base PerfLogger * class */ public PerfLogger getPerfLogger(boolean resetPerfLogger) { if ((perfLogger == null) || resetPerfLogger) { try { perfLogger = (PerfLogger) ReflectionUtils.newInstance( conf.getClassByName(conf.getVar(ConfVars.HIVE_PERF_LOGGER)), conf); } catch (ClassNotFoundException e) { LOG.error("Performance Logger Class not found:" + e.getMessage()); perfLogger = new PerfLogger(); } } return perfLogger; }
public static PerfLogger getPerfLogger(HiveConf conf, boolean resetPerfLogger) { PerfLogger result = perfLogger.get(); if (resetPerfLogger || result == null) { if (conf == null) { result = new PerfLogger(); } else { try { result = (PerfLogger) ReflectionUtils.newInstance( conf.getClassByName(conf.getVar(HiveConf.ConfVars.HIVE_PERF_LOGGER)), conf); } catch (ClassNotFoundException e) { LOG.error("Performance Logger Class not found:" + e.getMessage()); result = new PerfLogger(); } } perfLogger.set(result); } return result; }