private static void runCompactorThread(HiveConf hiveConf, CompactorThreadType type) throws Exception { AtomicBoolean stop = new AtomicBoolean(true); CompactorThread t = null; switch (type) { case INITIATOR: t = new Initiator(); break; case WORKER: t = new Worker(); break; case CLEANER: t = new Cleaner(); break; default: throw new IllegalArgumentException("Unknown type: " + type); } t.setThreadId((int) t.getId()); t.setConf(hiveConf); AtomicBoolean looped = new AtomicBoolean(); t.init(stop, looped); t.run(); }
private void startThread(char type, boolean stopAfterOne, AtomicBoolean looped) throws Exception { TxnDbUtil.setConfValues(conf); CompactorThread t = null; switch (type) { case 'i': t = new Initiator(); break; case 'w': t = new Worker(); break; case 'c': t = new Cleaner(); break; default: throw new RuntimeException("Huh? Unknown thread type."); } t.setThreadId((int) t.getId()); t.setConf(conf); stop.set(stopAfterOne); t.init(stop, looped); if (stopAfterOne) t.run(); else t.start(); }