org.elasticsearch.common.settings.Settings.getAsTime()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(10.0k)|赞(0)|评价(0)|浏览(148)

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

Settings.getAsTime介绍

[英]Returns the setting value (as time) associated with the setting key. If it does not exists, returns the default value provided.
[中]返回与设置键关联的设置值(作为时间)。如果不存在,则返回提供的默认值。

代码示例

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

private static TimeValue getValidThreshold(Settings settings, String key, String level) {
  TimeValue threshold = settings.getAsTime(level, null);
  if (threshold == null) {
    throw new IllegalArgumentException("missing gc_threshold for [" + getThresholdName(key, level) + "]");
  }
  if (threshold.nanos() <= 0) {
    throw new IllegalArgumentException("invalid gc_threshold [" + threshold + "] for [" + getThresholdName(key, level) + "]");
  }
  return threshold;
}

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

AsyncTrimTranslogTask(IndexService indexService) {
  super(indexService, indexService.getIndexSettings()
    .getSettings().getAsTime(INDEX_TRANSLOG_RETENTION_CHECK_INTERVAL_SETTING, TimeValue.timeValueMinutes(10)));
}

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

this.nodeEnv = nodeEnv;
this.xContentRegistry = xContentRegistry;
this.shardsClosedTimeout = settings.getAsTime(INDICES_SHARDS_CLOSED_TIMEOUT, new TimeValue(1, TimeUnit.DAYS));
this.analysisRegistry = analysisRegistry;
this.indexNameExpressionResolver = indexNameExpressionResolver;

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

@Override
  public void onRefreshSettings(Settings settings) {
    final TimeValue slowTaskLoggingThreshold = settings.getAsTime(SETTING_CLUSTER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD, InternalClusterService.this.slowTaskLoggingThreshold);
    InternalClusterService.this.slowTaskLoggingThreshold = slowTaskLoggingThreshold;
  }
}

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

/**
 * The allocation delay value in nano seconds associated with the index (defaulting to node settings if not set).
 */
public long getAllocationDelayTimeoutSettingNanos(Settings settings, Settings indexSettings) {
  if (reason != Reason.NODE_LEFT) {
    return 0;
  }
  TimeValue delayTimeout = indexSettings.getAsTime(INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING, settings.getAsTime(INDEX_DELAYED_NODE_LEFT_TIMEOUT_SETTING, DEFAULT_DELAYED_NODE_LEFT_TIMEOUT));
  return Math.max(0l, delayTimeout.nanos());
}

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

@Inject
public StoreRecoveryService(ShardId shardId, IndexSettingsService indexSettingsService, ThreadPool threadPool,
              MappingUpdatedAction mappingUpdatedAction, ClusterService clusterService, RepositoriesService repositoriesService, RestoreService restoreService) {
  super(shardId, indexSettingsService.getSettings());
  this.threadPool = threadPool;
  this.mappingUpdatedAction = mappingUpdatedAction;
  this.restoreService = restoreService;
  this.repositoriesService = repositoriesService;
  this.clusterService = clusterService;
  this.waitForMappingUpdatePostRecovery = indexSettings.getAsTime(SETTING_MAPPING_UPDATE_WAIT, indexSettings.getAsTime(SETTING_MAPPING_UPDATE_WAIT_LEGACY, TimeValue.timeValueSeconds(15)));
}

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

private static TimeValue getValidThreshold(Settings settings, String key, String level) {
  TimeValue threshold = settings.getAsTime(level, null);
  if (threshold == null) {
    throw new IllegalArgumentException("missing gc_threshold for [" + getThresholdName(key, level) + "]");
  }
  if (threshold.nanos() <= 0) {
    throw new IllegalArgumentException("invalid gc_threshold [" + threshold + "] for [" + getThresholdName(key, level) + "]");
  }
  return threshold;
}

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

private static TimeValue getValidThreshold(Settings settings, String key, String level) {
  TimeValue threshold = settings.getAsTime(level, null);
  if (threshold == null) {
    throw new IllegalArgumentException("missing gc_threshold for [" + getThresholdName(key, level) + "]");
  }
  if (threshold.nanos() <= 0) {
    throw new IllegalArgumentException("invalid gc_threshold [" + threshold + "] for [" + getThresholdName(key, level) + "]");
  }
  return threshold;
}

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

@Inject
public DiscoveryService(Settings settings, DiscoverySettings discoverySettings, Discovery discovery) {
  super(settings);
  this.discoverySettings = discoverySettings;
  this.discovery = discovery;
  this.initialStateTimeout = settings.getAsTime(SETTING_INITIAL_STATE_TIMEOUT, TimeValue.timeValueSeconds(30));
}

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

private static TimeValue getValidThreshold(Settings settings, String key, String level) {
  TimeValue threshold = settings.getAsTime(level, null);
  if (threshold == null) {
    throw new IllegalArgumentException("missing gc_threshold for [" + getThresholdName(key, level) + "]");
  }
  if (threshold.nanos() <= 0) {
    throw new IllegalArgumentException("invalid gc_threshold [" + threshold + "] for [" + getThresholdName(key, level) + "]");
  }
  return threshold;
}

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

@Override
  public void onRefreshSettings(Settings settings) {
    final TimeValue maybeNewDefaultSearchTimeout = settings.getAsTime(SearchService.DEFAULT_SEARCH_TIMEOUT, SearchService.this.defaultSearchTimeout);
    if (!maybeNewDefaultSearchTimeout.equals(SearchService.this.defaultSearchTimeout)) {
      logger.info("updating [{}] from [{}] to [{}]", SearchService.DEFAULT_SEARCH_TIMEOUT, SearchService.this.defaultSearchTimeout, maybeNewDefaultSearchTimeout);
      SearchService.this.defaultSearchTimeout = maybeNewDefaultSearchTimeout;
    }
  }
}

代码示例来源:origin: org.codelibs/elasticsearch-analysis-ja

public ReloadableKeywordMarkerFilterFactory(final IndexSettings indexSettings, final Environment environment, final String name, final Settings settings) {
  super(indexSettings, name, settings);
  final String path = settings.get("keywords_path");
  if (path != null) {
    keywordPath = environment.configFile().resolve(path);
  } else {
    keywordPath = null;
  }
  reloadInterval = settings.getAsTime("reload_interval", TimeValue.timeValueMinutes(1)).getMillis();
}

代码示例来源:origin: spinscale/elasticsearch-suggest-plugin

@Inject public SuggestService(Settings settings, TransportSuggestRefreshAction suggestRefreshAction,
    ClusterService clusterService, IndicesService indicesService) {
  super(settings);
  this.suggestRefreshAction = suggestRefreshAction;
  this.clusterService = clusterService;
  this.indicesService = indicesService;
  suggestRefreshDisabled = settings.getAsBoolean("suggest.refresh_disabled", false);
  suggestRefreshInterval = settings.getAsTime("suggest.refresh_interval", TimeValue.timeValueMinutes(10));
}

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

@Override
  public void onRefreshSettings(Settings settings) {
    final TimeValue currentInterval = IndicesTTLService.this.purgerThread.getInterval();
    final TimeValue interval = settings.getAsTime(INDICES_TTL_INTERVAL, currentInterval);
    if (!interval.equals(currentInterval)) {
      logger.info("updating indices.ttl.interval from [{}] to [{}]",currentInterval, interval);
      IndicesTTLService.this.purgerThread.resetInterval(interval);
    }
  }
}

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

@Inject
public JvmService(Settings settings) {
  super(settings);
  this.jvmInfo = JvmInfo.jvmInfo();
  this.jvmStats = JvmStats.jvmStats();
  this.refreshInterval = this.settings.getAsTime("refresh_interval", TimeValue.timeValueSeconds(1));
  logger.debug("Using refresh_interval [{}]", refreshInterval);
}

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

@Inject
public FsService(Settings settings, FsProbe probe) throws IOException {
  super(settings);
  this.probe = probe;
  TimeValue refreshInterval = settings.getAsTime("monitor.fs.refresh_interval", TimeValue.timeValueSeconds(1));
  fsStatsCache = new FsInfoCache(refreshInterval, probe.stats());
  logger.debug("Using probe [{}] with refresh_interval [{}]", probe, refreshInterval);
}

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

@Inject
public DiscoverySettings(Settings settings, NodeSettingsService nodeSettingsService) {
  super(settings);
  nodeSettingsService.addListener(new ApplySettings());
  this.noMasterBlock = parseNoMasterBlock(settings.get(NO_MASTER_BLOCK, DEFAULT_NO_MASTER_BLOCK));
  this.publishTimeout = settings.getAsTime(PUBLISH_TIMEOUT, publishTimeout);
  this.publishDiff = settings.getAsBoolean(PUBLISH_DIFF_ENABLE, DEFAULT_PUBLISH_DIFF_ENABLE);
}

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

@Inject
public ProcessService(Settings settings, ProcessProbe probe) {
  super(settings);
  this.probe = probe;
  final TimeValue refreshInterval = settings.getAsTime("monitor.process.refresh_interval", TimeValue.timeValueSeconds(1));
  processStatsCache = new ProcessStatsCache(refreshInterval, probe.processStats());
  this.info = probe.processInfo();
  this.info.refreshInterval = refreshInterval.millis();
  logger.debug("Using probe [{}] with refresh_interval [{}]", probe, refreshInterval);
}

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

@Inject
public IndicesTTLService(Settings settings, ClusterService clusterService, IndicesService indicesService, NodeSettingsService nodeSettingsService, TransportBulkAction bulkAction) {
  super(settings);
  this.clusterService = clusterService;
  this.indicesService = indicesService;
  TimeValue interval = this.settings.getAsTime("indices.ttl.interval", TimeValue.timeValueSeconds(60));
  this.bulkAction = bulkAction;
  this.bulkSize = this.settings.getAsInt("indices.ttl.bulk_size", 10000);
  this.purgerThread = new PurgerThread(EsExecutors.threadName(settings, "[ttl_expire]"), interval);
  nodeSettingsService.addListener(new ApplySettings());
}

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

public Store(ShardId shardId, Settings indexSettings, DirectoryService directoryService, ShardLock shardLock, OnClose onClose) throws IOException {
  super(shardId, indexSettings);
  this.directory = new StoreDirectory(directoryService.newDirectory(), Loggers.getLogger("index.store.deletes", indexSettings, shardId));
  this.shardLock = shardLock;
  this.onClose = onClose;
  final TimeValue refreshInterval = indexSettings.getAsTime(INDEX_STORE_STATS_REFRESH_INTERVAL, TimeValue.timeValueSeconds(10));
  this.statsCache = new StoreStatsCache(refreshInterval, directory, directoryService);
  logger.debug("store stats are refreshed with refresh_interval [{}]", refreshInterval);
  assert onClose != null;
  assert shardLock != null;
  assert shardLock.getShardId().equals(shardId);
}

相关文章