Java 类org.apache.hadoop.hbase.regionserver.handler.HLogSplitterHandler 实例源码

项目:HIndex    文件:SplitLogWorker.java   
/**
 * 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);
}
项目:PyroDB    文件:SplitLogWorker.java   
/**
 * 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);
}
项目:c5    文件:SplitLogWorker.java   
/**
 * 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);
}