/** * Submit a log split task to executor service * @param curTask * @param curTaskZKVersion */ void submitTask(final String curTask, final int curTaskZKVersion, final int reportPeriod) { final MutableInt zkVersion = new MutableInt(curTaskZKVersion); CancelableProgressable reporter = new CancelableProgressable() { private long last_report_at = 0; @Override public boolean progress() { long t = EnvironmentEdgeManager.currentTimeMillis(); if ((t - last_report_at) > reportPeriod) { last_report_at = t; int latestZKVersion = attemptToOwnTask(false, watcher, serverName, curTask, zkVersion.intValue()); if (latestZKVersion < 0) { LOG.warn("Failed to heartbeat the task" + curTask); return false; } zkVersion.setValue(latestZKVersion); } return true; } }; HLogSplitterHandler hsh = new HLogSplitterHandler(this.server, curTask, zkVersion, reporter, this.tasksInProgress, this.splitTaskExecutor); this.executorService.submit(hsh); }