private void startAssignmentThread() { // Get Server Thread name. Sometimes the Server is mocked so may not implement HasThread. // For example, in tests. String name = master instanceof HasThread? ((HasThread)master).getName(): master.getServerName().toShortString(); assignThread = new Thread(name) { @Override public void run() { while (isRunning()) { processAssignQueue(); } pendingAssignQueue.clear(); } }; assignThread.setDaemon(true); assignThread.start(); }
/** * Its OK to construct this object even when region-servers are not online. It does lookup the * orphan tasks in coordination engine but it doesn't block waiting for them to be done. * @param master the master services * @param conf the HBase configuration * @throws IOException */ public SplitLogManager(MasterServices master, Configuration conf) throws IOException { this.server = master; this.conf = conf; // Get Server Thread name. Sometimes the Server is mocked so may not implement HasThread. // For example, in tests. String name = master instanceof HasThread? ((HasThread)master).getName(): master.getServerName().toShortString(); this.choreService = new ChoreService(name + ".splitLogManager."); if (server.getCoordinatedStateManager() != null) { SplitLogManagerCoordination coordination = getSplitLogManagerCoordination(); Set<String> failedDeletions = Collections.synchronizedSet(new HashSet<String>()); SplitLogManagerDetails details = new SplitLogManagerDetails(tasks, master, failedDeletions); coordination.setDetails(details); coordination.init(); } this.unassignedTimeout = conf.getInt("hbase.splitlog.manager.unassigned.timeout", DEFAULT_UNASSIGNED_TIMEOUT); this.timeoutMonitor = new TimeoutMonitor(conf.getInt("hbase.splitlog.manager.timeoutmonitor.period", 1000), master); choreService.scheduleChore(timeoutMonitor); }
public static HasThread setDaemonThreadRunning(final HasThread t, final String name, final UncaughtExceptionHandler handler) { t.setName(name); if (handler != null) { t.setUncaughtExceptionHandler(handler); } t.setDaemon(true); t.start(); return t; }
public static HasThread setDaemonThreadRunning(final HasThread t, final String name) { return setDaemonThreadRunning(t, name, null); }