org.elasticsearch.threadpool.ThreadPool.scheduleWithFixedDelay()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(12.8k)|赞(0)|评价(0)|浏览(127)

本文整理了Java中org.elasticsearch.threadpool.ThreadPool.scheduleWithFixedDelay()方法的一些代码示例,展示了ThreadPool.scheduleWithFixedDelay()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ThreadPool.scheduleWithFixedDelay()方法的具体详情如下:
包路径:org.elasticsearch.threadpool.ThreadPool
类名称:ThreadPool
方法名:scheduleWithFixedDelay

ThreadPool.scheduleWithFixedDelay介绍

[英]Schedules a periodic action that runs on the specified thread pool.
[中]安排在指定线程池上运行的定期操作。

代码示例

代码示例来源:origin: org.elasticsearch/elasticsearch

@Override
protected void doStart() {
  if (!enabled) {
    return;
  }
  lowFuture = threadPool.scheduleWithFixedDelay(lowMonitor, lowMonitor.interval, Names.SAME);
  mediumFuture = threadPool.scheduleWithFixedDelay(mediumMonitor, mediumMonitor.interval, Names.SAME);
  highFuture = threadPool.scheduleWithFixedDelay(highMonitor, highMonitor.interval, Names.SAME);
}

代码示例来源:origin: org.elasticsearch/elasticsearch

protected Cancellable scheduleTask(ThreadPool threadPool) {
  // it's fine to run it on the scheduler thread, no busy work
  return threadPool.scheduleWithFixedDelay(statusChecker, interval, Names.SAME);
}

代码示例来源:origin: org.elasticsearch/elasticsearch

@Override
protected void doStart() {
  if (!enabled) {
    return;
  }
  scheduledFuture = threadPool.scheduleWithFixedDelay(new JvmMonitor(gcThresholds, gcOverheadThreshold) {
    @Override
    void onMonitorFailure(Exception e) {
      logger.debug("failed to monitor", e);
    }
    @Override
    void onSlowGc(final Threshold threshold, final long seq, final SlowGcEvent slowGcEvent) {
      logSlowGc(logger, threshold, seq, slowGcEvent, JvmGcMonitorService::buildPools);
    }
    @Override
    void onGcOverhead(final Threshold threshold, final long current, final long elapsed, final long seq) {
      logGcOverhead(logger, threshold, current, elapsed, seq);
    }
  }, interval, Names.SAME);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

@Override
protected void doStart() {
  if (!enabled) {
    return;
  }
  lowFuture = threadPool.scheduleWithFixedDelay(lowMonitor, lowMonitor.interval, Names.SAME);
  mediumFuture = threadPool.scheduleWithFixedDelay(mediumMonitor, mediumMonitor.interval, Names.SAME);
  highFuture = threadPool.scheduleWithFixedDelay(highMonitor, highMonitor.interval, Names.SAME);
}

代码示例来源:origin: apache/servicemix-bundles

protected Cancellable scheduleTask(ThreadPool threadPool) {
  // it's fine to run it on the scheduler thread, no busy work
  return threadPool.scheduleWithFixedDelay(statusChecker, interval, Names.SAME);
}

代码示例来源:origin: apache/servicemix-bundles

@Override
protected void doStart() {
  if (!enabled) {
    return;
  }
  lowFuture = threadPool.scheduleWithFixedDelay(lowMonitor, lowMonitor.interval, Names.SAME);
  mediumFuture = threadPool.scheduleWithFixedDelay(mediumMonitor, mediumMonitor.interval, Names.SAME);
  highFuture = threadPool.scheduleWithFixedDelay(highMonitor, highMonitor.interval, Names.SAME);
}

代码示例来源:origin: harbby/presto-connectors

@Override
protected void doStart() {
  if (!enabled) {
    return;
  }
  lowFuture = threadPool.scheduleWithFixedDelay(lowMonitor, lowMonitor.interval, Names.SAME);
  mediumFuture = threadPool.scheduleWithFixedDelay(mediumMonitor, mediumMonitor.interval, Names.SAME);
  highFuture = threadPool.scheduleWithFixedDelay(highMonitor, highMonitor.interval, Names.SAME);
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

@Override
protected void doStart() {
  if (!enabled) {
    return;
  }
  lowFuture = threadPool.scheduleWithFixedDelay(lowMonitor, lowMonitor.interval, Names.SAME);
  mediumFuture = threadPool.scheduleWithFixedDelay(mediumMonitor, mediumMonitor.interval, Names.SAME);
  highFuture = threadPool.scheduleWithFixedDelay(highMonitor, highMonitor.interval, Names.SAME);
}

代码示例来源:origin: harbby/presto-connectors

@Override
protected void doStart() {
  // it's fine to run it on the scheduler thread, no busy work
  this.scheduler = threadPool.scheduleWithFixedDelay(statusChecker, interval, Names.SAME);
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

protected Cancellable scheduleTask(ThreadPool threadPool) {
  // it's fine to run it on the scheduler thread, no busy work
  return threadPool.scheduleWithFixedDelay(statusChecker, interval, Names.SAME);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

protected Cancellable scheduleTask(ThreadPool threadPool) {
  // it's fine to run it on the scheduler thread, no busy work
  return threadPool.scheduleWithFixedDelay(statusChecker, interval, Names.SAME);
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

@Override
protected void doStart() {
  if (!enabled) {
    return;
  }
  scheduledFuture = threadPool.scheduleWithFixedDelay(new JvmMonitor(gcThresholds, gcOverheadThreshold) {
    @Override
    void onMonitorFailure(Exception e) {
      logger.debug("failed to monitor", e);
    }
    @Override
    void onSlowGc(final Threshold threshold, final long seq, final SlowGcEvent slowGcEvent) {
      logSlowGc(logger, threshold, seq, slowGcEvent, JvmGcMonitorService::buildPools);
    }
    @Override
    void onGcOverhead(final Threshold threshold, final long current, final long elapsed, final long seq) {
      logGcOverhead(logger, threshold, current, elapsed, seq);
    }
  }, interval, Names.SAME);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

@Override
protected void doStart() {
  if (!enabled) {
    return;
  }
  scheduledFuture = threadPool.scheduleWithFixedDelay(new JvmMonitor(gcThresholds, gcOverheadThreshold) {
    @Override
    void onMonitorFailure(Exception e) {
      logger.debug("failed to monitor", e);
    }
    @Override
    void onSlowGc(final Threshold threshold, final long seq, final SlowGcEvent slowGcEvent) {
      logSlowGc(logger, threshold, seq, slowGcEvent, JvmGcMonitorService::buildPools);
    }
    @Override
    void onGcOverhead(final Threshold threshold, final long current, final long elapsed, final long seq) {
      logGcOverhead(logger, threshold, current, elapsed, seq);
    }
  }, interval, Names.SAME);
}

代码示例来源:origin: apache/servicemix-bundles

@Override
protected void doStart() {
  if (!enabled) {
    return;
  }
  scheduledFuture = threadPool.scheduleWithFixedDelay(new JvmMonitor(gcThresholds, gcOverheadThreshold) {
    @Override
    void onMonitorFailure(Exception e) {
      logger.debug("failed to monitor", e);
    }
    @Override
    void onSlowGc(final Threshold threshold, final long seq, final SlowGcEvent slowGcEvent) {
      logSlowGc(logger, threshold, seq, slowGcEvent, JvmGcMonitorService::buildPools);
    }
    @Override
    void onGcOverhead(final Threshold threshold, final long current, final long elapsed, final long seq) {
      logGcOverhead(logger, threshold, current, elapsed, seq);
    }
  }, interval, Names.SAME);
}

代码示例来源:origin: harbby/presto-connectors

@Override
protected void doStart() {
  if (!enabled) {
    return;
  }
  cancellable = threadPool.scheduleWithFixedDelay(new JvmMonitor(), interval, Names.SAME);
}

代码示例来源:origin: org.elasticsearch/elasticsearch

public SearchService(ClusterService clusterService, IndicesService indicesService,
           ThreadPool threadPool, ScriptService scriptService, BigArrays bigArrays, FetchPhase fetchPhase,
           ResponseCollectorService responseCollectorService) {
  super(clusterService.getSettings());
  Settings settings = clusterService.getSettings();
  this.threadPool = threadPool;
  this.clusterService = clusterService;
  this.indicesService = indicesService;
  this.scriptService = scriptService;
  this.responseCollectorService = responseCollectorService;
  this.bigArrays = bigArrays;
  this.queryPhase = new QueryPhase();
  this.fetchPhase = fetchPhase;
  this.multiBucketConsumerService = new MultiBucketConsumerService(clusterService, settings);
  TimeValue keepAliveInterval = KEEPALIVE_INTERVAL_SETTING.get(settings);
  setKeepAlives(DEFAULT_KEEPALIVE_SETTING.get(settings), MAX_KEEPALIVE_SETTING.get(settings));
  clusterService.getClusterSettings().addSettingsUpdateConsumer(DEFAULT_KEEPALIVE_SETTING, MAX_KEEPALIVE_SETTING,
    this::setKeepAlives, this::validateKeepAlives);
  this.keepAliveReaper = threadPool.scheduleWithFixedDelay(new Reaper(), keepAliveInterval, Names.SAME);
  defaultSearchTimeout = DEFAULT_SEARCH_TIMEOUT_SETTING.get(settings);
  clusterService.getClusterSettings().addSettingsUpdateConsumer(DEFAULT_SEARCH_TIMEOUT_SETTING, this::setDefaultSearchTimeout);
  defaultAllowPartialSearchResults = DEFAULT_ALLOW_PARTIAL_SEARCH_RESULTS.get(settings);
  clusterService.getClusterSettings().addSettingsUpdateConsumer(DEFAULT_ALLOW_PARTIAL_SEARCH_RESULTS,
      this::setDefaultAllowPartialSearchResults);
  maxOpenScrollContext = MAX_OPEN_SCROLL_CONTEXT.get(settings);
  clusterService.getClusterSettings().addSettingsUpdateConsumer(MAX_OPEN_SCROLL_CONTEXT, this::setMaxOpenScrollContext);
  lowLevelCancellation = LOW_LEVEL_CANCELLATION_SETTING.get(settings);
  clusterService.getClusterSettings().addSettingsUpdateConsumer(LOW_LEVEL_CANCELLATION_SETTING, this::setLowLevelCancellation);
}

代码示例来源:origin: harbby/presto-connectors

this.elementParsers = ImmutableMap.copyOf(elementParsers);
this.keepAliveReaper = threadPool.scheduleWithFixedDelay(new Reaper(), keepAliveInterval, Names.SAME);

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

public SearchService(ClusterService clusterService, IndicesService indicesService,
           ThreadPool threadPool, ScriptService scriptService, BigArrays bigArrays, FetchPhase fetchPhase) {
  super(clusterService.getSettings());
  this.threadPool = threadPool;
  this.clusterService = clusterService;
  this.indicesService = indicesService;
  this.scriptService = scriptService;
  this.bigArrays = bigArrays;
  this.queryPhase = new QueryPhase(settings);
  this.fetchPhase = fetchPhase;
  TimeValue keepAliveInterval = KEEPALIVE_INTERVAL_SETTING.get(settings);
  this.defaultKeepAlive = DEFAULT_KEEPALIVE_SETTING.get(settings).millis();
  this.keepAliveReaper = threadPool.scheduleWithFixedDelay(new Reaper(), keepAliveInterval, Names.SAME);
  defaultSearchTimeout = DEFAULT_SEARCH_TIMEOUT_SETTING.get(settings);
  clusterService.getClusterSettings().addSettingsUpdateConsumer(DEFAULT_SEARCH_TIMEOUT_SETTING, this::setDefaultSearchTimeout);
  lowLevelCancellation = LOW_LEVEL_CANCELLATION_SETTING.get(settings);
  clusterService.getClusterSettings().addSettingsUpdateConsumer(LOW_LEVEL_CANCELLATION_SETTING, this::setLowLevelCancellation);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.elasticsearch

public SearchService(ClusterService clusterService, IndicesService indicesService,
           ThreadPool threadPool, ScriptService scriptService, BigArrays bigArrays, FetchPhase fetchPhase,
           ResponseCollectorService responseCollectorService) {
  super(clusterService.getSettings());
  this.threadPool = threadPool;
  this.clusterService = clusterService;
  this.indicesService = indicesService;
  this.scriptService = scriptService;
  this.responseCollectorService = responseCollectorService;
  this.bigArrays = bigArrays;
  this.queryPhase = new QueryPhase(settings);
  this.fetchPhase = fetchPhase;
  this.multiBucketConsumerService = new MultiBucketConsumerService(clusterService, settings);
  TimeValue keepAliveInterval = KEEPALIVE_INTERVAL_SETTING.get(settings);
  setKeepAlives(DEFAULT_KEEPALIVE_SETTING.get(settings), MAX_KEEPALIVE_SETTING.get(settings));
  clusterService.getClusterSettings().addSettingsUpdateConsumer(DEFAULT_KEEPALIVE_SETTING, MAX_KEEPALIVE_SETTING,
    this::setKeepAlives, this::validateKeepAlives);
  this.keepAliveReaper = threadPool.scheduleWithFixedDelay(new Reaper(), keepAliveInterval, Names.SAME);
  defaultSearchTimeout = DEFAULT_SEARCH_TIMEOUT_SETTING.get(settings);
  clusterService.getClusterSettings().addSettingsUpdateConsumer(DEFAULT_SEARCH_TIMEOUT_SETTING, this::setDefaultSearchTimeout);
  defaultAllowPartialSearchResults = DEFAULT_ALLOW_PARTIAL_SEARCH_RESULTS.get(settings);
  clusterService.getClusterSettings().addSettingsUpdateConsumer(DEFAULT_ALLOW_PARTIAL_SEARCH_RESULTS,
      this::setDefaultAllowPartialSearchResults);
  lowLevelCancellation = LOW_LEVEL_CANCELLATION_SETTING.get(settings);
  clusterService.getClusterSettings().addSettingsUpdateConsumer(LOW_LEVEL_CANCELLATION_SETTING, this::setLowLevelCancellation);
}

代码示例来源:origin: apache/servicemix-bundles

public SearchService(ClusterService clusterService, IndicesService indicesService,
           ThreadPool threadPool, ScriptService scriptService, BigArrays bigArrays, FetchPhase fetchPhase,
           ResponseCollectorService responseCollectorService) {
  super(clusterService.getSettings());
  this.threadPool = threadPool;
  this.clusterService = clusterService;
  this.indicesService = indicesService;
  this.scriptService = scriptService;
  this.responseCollectorService = responseCollectorService;
  this.bigArrays = bigArrays;
  this.queryPhase = new QueryPhase(settings);
  this.fetchPhase = fetchPhase;
  this.multiBucketConsumerService = new MultiBucketConsumerService(clusterService, settings);
  TimeValue keepAliveInterval = KEEPALIVE_INTERVAL_SETTING.get(settings);
  setKeepAlives(DEFAULT_KEEPALIVE_SETTING.get(settings), MAX_KEEPALIVE_SETTING.get(settings));
  clusterService.getClusterSettings().addSettingsUpdateConsumer(DEFAULT_KEEPALIVE_SETTING, MAX_KEEPALIVE_SETTING,
    this::setKeepAlives, this::validateKeepAlives);
  this.keepAliveReaper = threadPool.scheduleWithFixedDelay(new Reaper(), keepAliveInterval, Names.SAME);
  defaultSearchTimeout = DEFAULT_SEARCH_TIMEOUT_SETTING.get(settings);
  clusterService.getClusterSettings().addSettingsUpdateConsumer(DEFAULT_SEARCH_TIMEOUT_SETTING, this::setDefaultSearchTimeout);
  defaultAllowPartialSearchResults = DEFAULT_ALLOW_PARTIAL_SEARCH_RESULTS.get(settings);
  clusterService.getClusterSettings().addSettingsUpdateConsumer(DEFAULT_ALLOW_PARTIAL_SEARCH_RESULTS,
      this::setDefaultAllowPartialSearchResults);
  lowLevelCancellation = LOW_LEVEL_CANCELLATION_SETTING.get(settings);
  clusterService.getClusterSettings().addSettingsUpdateConsumer(LOW_LEVEL_CANCELLATION_SETTING, this::setLowLevelCancellation);
}

相关文章