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

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

本文整理了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

  1. @Override
  2. protected void doStart() {
  3. if (!enabled) {
  4. return;
  5. }
  6. lowFuture = threadPool.scheduleWithFixedDelay(lowMonitor, lowMonitor.interval, Names.SAME);
  7. mediumFuture = threadPool.scheduleWithFixedDelay(mediumMonitor, mediumMonitor.interval, Names.SAME);
  8. highFuture = threadPool.scheduleWithFixedDelay(highMonitor, highMonitor.interval, Names.SAME);
  9. }

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

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

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

  1. @Override
  2. protected void doStart() {
  3. if (!enabled) {
  4. return;
  5. }
  6. scheduledFuture = threadPool.scheduleWithFixedDelay(new JvmMonitor(gcThresholds, gcOverheadThreshold) {
  7. @Override
  8. void onMonitorFailure(Exception e) {
  9. logger.debug("failed to monitor", e);
  10. }
  11. @Override
  12. void onSlowGc(final Threshold threshold, final long seq, final SlowGcEvent slowGcEvent) {
  13. logSlowGc(logger, threshold, seq, slowGcEvent, JvmGcMonitorService::buildPools);
  14. }
  15. @Override
  16. void onGcOverhead(final Threshold threshold, final long current, final long elapsed, final long seq) {
  17. logGcOverhead(logger, threshold, current, elapsed, seq);
  18. }
  19. }, interval, Names.SAME);
  20. }

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

  1. @Override
  2. protected void doStart() {
  3. if (!enabled) {
  4. return;
  5. }
  6. lowFuture = threadPool.scheduleWithFixedDelay(lowMonitor, lowMonitor.interval, Names.SAME);
  7. mediumFuture = threadPool.scheduleWithFixedDelay(mediumMonitor, mediumMonitor.interval, Names.SAME);
  8. highFuture = threadPool.scheduleWithFixedDelay(highMonitor, highMonitor.interval, Names.SAME);
  9. }

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

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

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

  1. @Override
  2. protected void doStart() {
  3. if (!enabled) {
  4. return;
  5. }
  6. lowFuture = threadPool.scheduleWithFixedDelay(lowMonitor, lowMonitor.interval, Names.SAME);
  7. mediumFuture = threadPool.scheduleWithFixedDelay(mediumMonitor, mediumMonitor.interval, Names.SAME);
  8. highFuture = threadPool.scheduleWithFixedDelay(highMonitor, highMonitor.interval, Names.SAME);
  9. }

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

  1. @Override
  2. protected void doStart() {
  3. if (!enabled) {
  4. return;
  5. }
  6. lowFuture = threadPool.scheduleWithFixedDelay(lowMonitor, lowMonitor.interval, Names.SAME);
  7. mediumFuture = threadPool.scheduleWithFixedDelay(mediumMonitor, mediumMonitor.interval, Names.SAME);
  8. highFuture = threadPool.scheduleWithFixedDelay(highMonitor, highMonitor.interval, Names.SAME);
  9. }

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

  1. @Override
  2. protected void doStart() {
  3. if (!enabled) {
  4. return;
  5. }
  6. lowFuture = threadPool.scheduleWithFixedDelay(lowMonitor, lowMonitor.interval, Names.SAME);
  7. mediumFuture = threadPool.scheduleWithFixedDelay(mediumMonitor, mediumMonitor.interval, Names.SAME);
  8. highFuture = threadPool.scheduleWithFixedDelay(highMonitor, highMonitor.interval, Names.SAME);
  9. }

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

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

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

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

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

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

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

  1. @Override
  2. protected void doStart() {
  3. if (!enabled) {
  4. return;
  5. }
  6. scheduledFuture = threadPool.scheduleWithFixedDelay(new JvmMonitor(gcThresholds, gcOverheadThreshold) {
  7. @Override
  8. void onMonitorFailure(Exception e) {
  9. logger.debug("failed to monitor", e);
  10. }
  11. @Override
  12. void onSlowGc(final Threshold threshold, final long seq, final SlowGcEvent slowGcEvent) {
  13. logSlowGc(logger, threshold, seq, slowGcEvent, JvmGcMonitorService::buildPools);
  14. }
  15. @Override
  16. void onGcOverhead(final Threshold threshold, final long current, final long elapsed, final long seq) {
  17. logGcOverhead(logger, threshold, current, elapsed, seq);
  18. }
  19. }, interval, Names.SAME);
  20. }

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

  1. @Override
  2. protected void doStart() {
  3. if (!enabled) {
  4. return;
  5. }
  6. scheduledFuture = threadPool.scheduleWithFixedDelay(new JvmMonitor(gcThresholds, gcOverheadThreshold) {
  7. @Override
  8. void onMonitorFailure(Exception e) {
  9. logger.debug("failed to monitor", e);
  10. }
  11. @Override
  12. void onSlowGc(final Threshold threshold, final long seq, final SlowGcEvent slowGcEvent) {
  13. logSlowGc(logger, threshold, seq, slowGcEvent, JvmGcMonitorService::buildPools);
  14. }
  15. @Override
  16. void onGcOverhead(final Threshold threshold, final long current, final long elapsed, final long seq) {
  17. logGcOverhead(logger, threshold, current, elapsed, seq);
  18. }
  19. }, interval, Names.SAME);
  20. }

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

  1. @Override
  2. protected void doStart() {
  3. if (!enabled) {
  4. return;
  5. }
  6. scheduledFuture = threadPool.scheduleWithFixedDelay(new JvmMonitor(gcThresholds, gcOverheadThreshold) {
  7. @Override
  8. void onMonitorFailure(Exception e) {
  9. logger.debug("failed to monitor", e);
  10. }
  11. @Override
  12. void onSlowGc(final Threshold threshold, final long seq, final SlowGcEvent slowGcEvent) {
  13. logSlowGc(logger, threshold, seq, slowGcEvent, JvmGcMonitorService::buildPools);
  14. }
  15. @Override
  16. void onGcOverhead(final Threshold threshold, final long current, final long elapsed, final long seq) {
  17. logGcOverhead(logger, threshold, current, elapsed, seq);
  18. }
  19. }, interval, Names.SAME);
  20. }

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

  1. @Override
  2. protected void doStart() {
  3. if (!enabled) {
  4. return;
  5. }
  6. cancellable = threadPool.scheduleWithFixedDelay(new JvmMonitor(), interval, Names.SAME);
  7. }

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

  1. public SearchService(ClusterService clusterService, IndicesService indicesService,
  2. ThreadPool threadPool, ScriptService scriptService, BigArrays bigArrays, FetchPhase fetchPhase,
  3. ResponseCollectorService responseCollectorService) {
  4. super(clusterService.getSettings());
  5. Settings settings = clusterService.getSettings();
  6. this.threadPool = threadPool;
  7. this.clusterService = clusterService;
  8. this.indicesService = indicesService;
  9. this.scriptService = scriptService;
  10. this.responseCollectorService = responseCollectorService;
  11. this.bigArrays = bigArrays;
  12. this.queryPhase = new QueryPhase();
  13. this.fetchPhase = fetchPhase;
  14. this.multiBucketConsumerService = new MultiBucketConsumerService(clusterService, settings);
  15. TimeValue keepAliveInterval = KEEPALIVE_INTERVAL_SETTING.get(settings);
  16. setKeepAlives(DEFAULT_KEEPALIVE_SETTING.get(settings), MAX_KEEPALIVE_SETTING.get(settings));
  17. clusterService.getClusterSettings().addSettingsUpdateConsumer(DEFAULT_KEEPALIVE_SETTING, MAX_KEEPALIVE_SETTING,
  18. this::setKeepAlives, this::validateKeepAlives);
  19. this.keepAliveReaper = threadPool.scheduleWithFixedDelay(new Reaper(), keepAliveInterval, Names.SAME);
  20. defaultSearchTimeout = DEFAULT_SEARCH_TIMEOUT_SETTING.get(settings);
  21. clusterService.getClusterSettings().addSettingsUpdateConsumer(DEFAULT_SEARCH_TIMEOUT_SETTING, this::setDefaultSearchTimeout);
  22. defaultAllowPartialSearchResults = DEFAULT_ALLOW_PARTIAL_SEARCH_RESULTS.get(settings);
  23. clusterService.getClusterSettings().addSettingsUpdateConsumer(DEFAULT_ALLOW_PARTIAL_SEARCH_RESULTS,
  24. this::setDefaultAllowPartialSearchResults);
  25. maxOpenScrollContext = MAX_OPEN_SCROLL_CONTEXT.get(settings);
  26. clusterService.getClusterSettings().addSettingsUpdateConsumer(MAX_OPEN_SCROLL_CONTEXT, this::setMaxOpenScrollContext);
  27. lowLevelCancellation = LOW_LEVEL_CANCELLATION_SETTING.get(settings);
  28. clusterService.getClusterSettings().addSettingsUpdateConsumer(LOW_LEVEL_CANCELLATION_SETTING, this::setLowLevelCancellation);
  29. }

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

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

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

  1. public SearchService(ClusterService clusterService, IndicesService indicesService,
  2. ThreadPool threadPool, ScriptService scriptService, BigArrays bigArrays, FetchPhase fetchPhase) {
  3. super(clusterService.getSettings());
  4. this.threadPool = threadPool;
  5. this.clusterService = clusterService;
  6. this.indicesService = indicesService;
  7. this.scriptService = scriptService;
  8. this.bigArrays = bigArrays;
  9. this.queryPhase = new QueryPhase(settings);
  10. this.fetchPhase = fetchPhase;
  11. TimeValue keepAliveInterval = KEEPALIVE_INTERVAL_SETTING.get(settings);
  12. this.defaultKeepAlive = DEFAULT_KEEPALIVE_SETTING.get(settings).millis();
  13. this.keepAliveReaper = threadPool.scheduleWithFixedDelay(new Reaper(), keepAliveInterval, Names.SAME);
  14. defaultSearchTimeout = DEFAULT_SEARCH_TIMEOUT_SETTING.get(settings);
  15. clusterService.getClusterSettings().addSettingsUpdateConsumer(DEFAULT_SEARCH_TIMEOUT_SETTING, this::setDefaultSearchTimeout);
  16. lowLevelCancellation = LOW_LEVEL_CANCELLATION_SETTING.get(settings);
  17. clusterService.getClusterSettings().addSettingsUpdateConsumer(LOW_LEVEL_CANCELLATION_SETTING, this::setLowLevelCancellation);
  18. }

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

  1. public SearchService(ClusterService clusterService, IndicesService indicesService,
  2. ThreadPool threadPool, ScriptService scriptService, BigArrays bigArrays, FetchPhase fetchPhase,
  3. ResponseCollectorService responseCollectorService) {
  4. super(clusterService.getSettings());
  5. this.threadPool = threadPool;
  6. this.clusterService = clusterService;
  7. this.indicesService = indicesService;
  8. this.scriptService = scriptService;
  9. this.responseCollectorService = responseCollectorService;
  10. this.bigArrays = bigArrays;
  11. this.queryPhase = new QueryPhase(settings);
  12. this.fetchPhase = fetchPhase;
  13. this.multiBucketConsumerService = new MultiBucketConsumerService(clusterService, settings);
  14. TimeValue keepAliveInterval = KEEPALIVE_INTERVAL_SETTING.get(settings);
  15. setKeepAlives(DEFAULT_KEEPALIVE_SETTING.get(settings), MAX_KEEPALIVE_SETTING.get(settings));
  16. clusterService.getClusterSettings().addSettingsUpdateConsumer(DEFAULT_KEEPALIVE_SETTING, MAX_KEEPALIVE_SETTING,
  17. this::setKeepAlives, this::validateKeepAlives);
  18. this.keepAliveReaper = threadPool.scheduleWithFixedDelay(new Reaper(), keepAliveInterval, Names.SAME);
  19. defaultSearchTimeout = DEFAULT_SEARCH_TIMEOUT_SETTING.get(settings);
  20. clusterService.getClusterSettings().addSettingsUpdateConsumer(DEFAULT_SEARCH_TIMEOUT_SETTING, this::setDefaultSearchTimeout);
  21. defaultAllowPartialSearchResults = DEFAULT_ALLOW_PARTIAL_SEARCH_RESULTS.get(settings);
  22. clusterService.getClusterSettings().addSettingsUpdateConsumer(DEFAULT_ALLOW_PARTIAL_SEARCH_RESULTS,
  23. this::setDefaultAllowPartialSearchResults);
  24. lowLevelCancellation = LOW_LEVEL_CANCELLATION_SETTING.get(settings);
  25. clusterService.getClusterSettings().addSettingsUpdateConsumer(LOW_LEVEL_CANCELLATION_SETTING, this::setLowLevelCancellation);
  26. }

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

  1. public SearchService(ClusterService clusterService, IndicesService indicesService,
  2. ThreadPool threadPool, ScriptService scriptService, BigArrays bigArrays, FetchPhase fetchPhase,
  3. ResponseCollectorService responseCollectorService) {
  4. super(clusterService.getSettings());
  5. this.threadPool = threadPool;
  6. this.clusterService = clusterService;
  7. this.indicesService = indicesService;
  8. this.scriptService = scriptService;
  9. this.responseCollectorService = responseCollectorService;
  10. this.bigArrays = bigArrays;
  11. this.queryPhase = new QueryPhase(settings);
  12. this.fetchPhase = fetchPhase;
  13. this.multiBucketConsumerService = new MultiBucketConsumerService(clusterService, settings);
  14. TimeValue keepAliveInterval = KEEPALIVE_INTERVAL_SETTING.get(settings);
  15. setKeepAlives(DEFAULT_KEEPALIVE_SETTING.get(settings), MAX_KEEPALIVE_SETTING.get(settings));
  16. clusterService.getClusterSettings().addSettingsUpdateConsumer(DEFAULT_KEEPALIVE_SETTING, MAX_KEEPALIVE_SETTING,
  17. this::setKeepAlives, this::validateKeepAlives);
  18. this.keepAliveReaper = threadPool.scheduleWithFixedDelay(new Reaper(), keepAliveInterval, Names.SAME);
  19. defaultSearchTimeout = DEFAULT_SEARCH_TIMEOUT_SETTING.get(settings);
  20. clusterService.getClusterSettings().addSettingsUpdateConsumer(DEFAULT_SEARCH_TIMEOUT_SETTING, this::setDefaultSearchTimeout);
  21. defaultAllowPartialSearchResults = DEFAULT_ALLOW_PARTIAL_SEARCH_RESULTS.get(settings);
  22. clusterService.getClusterSettings().addSettingsUpdateConsumer(DEFAULT_ALLOW_PARTIAL_SEARCH_RESULTS,
  23. this::setDefaultAllowPartialSearchResults);
  24. lowLevelCancellation = LOW_LEVEL_CANCELLATION_SETTING.get(settings);
  25. clusterService.getClusterSettings().addSettingsUpdateConsumer(LOW_LEVEL_CANCELLATION_SETTING, this::setLowLevelCancellation);
  26. }

相关文章