当前位置: 首页>>代码示例>>Java>>正文


Java Settings.getAsDouble方法代码示例

本文整理汇总了Java中org.elasticsearch.common.settings.Settings.getAsDouble方法的典型用法代码示例。如果您正苦于以下问题:Java Settings.getAsDouble方法的具体用法?Java Settings.getAsDouble怎么用?Java Settings.getAsDouble使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.elasticsearch.common.settings.Settings的用法示例。


在下文中一共展示了Settings.getAsDouble方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: CrateCircuitBreakerService

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
@Inject
public CrateCircuitBreakerService(Settings settings,
                                  NodeSettingsService nodeSettingsService,
                                  CircuitBreakerService esCircuitBreakerService) {
    super(settings);
    this.esCircuitBreakerService = esCircuitBreakerService;

    long memoryLimit = settings.getAsMemory(
            QUERY_CIRCUIT_BREAKER_LIMIT_SETTING,
            DEFAULT_QUERY_CIRCUIT_BREAKER_LIMIT).bytes();
    double overhead = settings.getAsDouble(
            QUERY_CIRCUIT_BREAKER_OVERHEAD_SETTING,
            DEFAULT_QUERY_CIRCUIT_BREAKER_OVERHEAD_CONSTANT);

    queryBreakerSettings = new BreakerSettings(QUERY, memoryLimit, overhead,
            CircuitBreaker.Type.parseValue(
                    settings.get(QUERY_CIRCUIT_BREAKER_TYPE_SETTING,
                    DEFAULT_QUERY_CIRCUIT_BREAKER_TYPE)));

    registerBreaker(queryBreakerSettings);
    nodeSettingsService.addListener(new ApplySettings());
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:23,代码来源:CrateCircuitBreakerService.java

示例2: onRefreshSettings

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
@Override
public void onRefreshSettings(Settings settings) {

    // Query breaker settings
    long newQueryMax = settings.getAsMemory(
            QUERY_CIRCUIT_BREAKER_LIMIT_SETTING,
            CrateCircuitBreakerService.this.settings.getAsMemory(
                    QUERY_CIRCUIT_BREAKER_LIMIT_SETTING,
                    DEFAULT_QUERY_CIRCUIT_BREAKER_LIMIT
            ).toString()).bytes();
    Double newQueryOverhead = settings.getAsDouble(
            QUERY_CIRCUIT_BREAKER_OVERHEAD_SETTING,
            CrateCircuitBreakerService.this.settings.getAsDouble(
                    QUERY_CIRCUIT_BREAKER_OVERHEAD_SETTING,
                    DEFAULT_QUERY_CIRCUIT_BREAKER_OVERHEAD_CONSTANT
            ));
    if (newQueryMax != CrateCircuitBreakerService.this.queryBreakerSettings.getLimit()
            || newQueryOverhead != CrateCircuitBreakerService.this.queryBreakerSettings.getOverhead()) {

        BreakerSettings newQuerySettings = new BreakerSettings(
                QUERY, newQueryMax, newQueryOverhead,
                CrateCircuitBreakerService.this.queryBreakerSettings.getType());
        registerBreaker(newQuerySettings);
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:26,代码来源:CrateCircuitBreakerService.java

示例3: MergePolicyConfig

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
public MergePolicyConfig(ESLogger logger, Settings indexSettings) {
    this.logger = logger;
    this.noCFSRatio = parseNoCFSRatio(indexSettings.get(INDEX_COMPOUND_FORMAT, Double.toString(TieredMergePolicy.DEFAULT_NO_CFS_RATIO)));
    double forceMergeDeletesPctAllowed = indexSettings.getAsDouble("index.merge.policy.expunge_deletes_allowed", DEFAULT_EXPUNGE_DELETES_ALLOWED); // percentage
    ByteSizeValue floorSegment = indexSettings.getAsBytesSize("index.merge.policy.floor_segment", DEFAULT_FLOOR_SEGMENT);
    int maxMergeAtOnce = indexSettings.getAsInt("index.merge.policy.max_merge_at_once", DEFAULT_MAX_MERGE_AT_ONCE);
    int maxMergeAtOnceExplicit = indexSettings.getAsInt("index.merge.policy.max_merge_at_once_explicit", DEFAULT_MAX_MERGE_AT_ONCE_EXPLICIT);
    // TODO is this really a good default number for max_merge_segment, what happens for large indices, won't they end up with many segments?
    ByteSizeValue maxMergedSegment = indexSettings.getAsBytesSize("index.merge.policy.max_merged_segment", DEFAULT_MAX_MERGED_SEGMENT);
    double segmentsPerTier = indexSettings.getAsDouble("index.merge.policy.segments_per_tier", DEFAULT_SEGMENTS_PER_TIER);
    double reclaimDeletesWeight = indexSettings.getAsDouble("index.merge.policy.reclaim_deletes_weight", DEFAULT_RECLAIM_DELETES_WEIGHT);
    this.mergesEnabled = indexSettings.getAsBoolean(INDEX_MERGE_ENABLED, true);
    if (mergesEnabled == false) {
        logger.warn("[{}] is set to false, this should only be used in tests and can cause serious problems in production environments", INDEX_MERGE_ENABLED);
    }
    maxMergeAtOnce = adjustMaxMergeAtOnceIfNeeded(maxMergeAtOnce, segmentsPerTier);
    mergePolicy.setNoCFSRatio(noCFSRatio);
    mergePolicy.setForceMergeDeletesPctAllowed(forceMergeDeletesPctAllowed);
    mergePolicy.setFloorSegmentMB(floorSegment.mbFrac());
    mergePolicy.setMaxMergeAtOnce(maxMergeAtOnce);
    mergePolicy.setMaxMergeAtOnceExplicit(maxMergeAtOnceExplicit);
    mergePolicy.setMaxMergedSegmentMB(maxMergedSegment.mbFrac());
    mergePolicy.setSegmentsPerTier(segmentsPerTier);
    mergePolicy.setReclaimDeletesWeight(reclaimDeletesWeight);
    logger.debug("using [tiered] merge mergePolicy with expunge_deletes_allowed[{}], floor_segment[{}], max_merge_at_once[{}], max_merge_at_once_explicit[{}], max_merged_segment[{}], segments_per_tier[{}], reclaim_deletes_weight[{}]",
            forceMergeDeletesPctAllowed, floorSegment, maxMergeAtOnce, maxMergeAtOnceExplicit, maxMergedSegment, segmentsPerTier, reclaimDeletesWeight);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:28,代码来源:MergePolicyConfig.java

示例4: ThrowingSubReaderWrapper

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
ThrowingSubReaderWrapper(Settings settings) {
    final long seed = ESIntegTestCase.INDEX_TEST_SEED_SETTING.get(settings);
    this.topLevelRatio = settings.getAsDouble(EXCEPTION_TOP_LEVEL_RATIO_KEY, 0.1d);
    this.lowLevelRatio = settings.getAsDouble(EXCEPTION_LOW_LEVEL_RATIO_KEY, 0.1d);
    this.random = new Random(seed);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:7,代码来源:SearchWithRandomExceptionsIT.java

示例5: TestAmazonS3

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
public TestAmazonS3(AmazonS3 delegate, Settings settings) {
    super(delegate);
    randomPrefix = settings.get("cloud.aws.test.random");
    writeFailureRate = settings.getAsDouble("cloud.aws.test.write_failures", 0.0);
    readFailureRate = settings.getAsDouble("cloud.aws.test.read_failures", 0.0);
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:7,代码来源:TestAmazonS3.java

示例6: extract

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
@Override
public Double extract(Settings settings) {
    return settings.getAsDouble(settingName(), defaultValue());
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:5,代码来源:DoubleSetting.java

示例7: HierarchyCircuitBreakerService

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
@Inject
public HierarchyCircuitBreakerService(Settings settings, NodeSettingsService nodeSettingsService) {
    super(settings);

    // This uses the old InternalCircuitBreakerService.CIRCUIT_BREAKER_MAX_BYTES_SETTING
    // setting to keep backwards compatibility with 1.3, it can be safely
    // removed when compatibility with 1.3 is no longer needed
    String compatibilityFielddataLimitDefault = DEFAULT_FIELDDATA_BREAKER_LIMIT;
    ByteSizeValue compatibilityFielddataLimit = settings.getAsMemory(OLD_CIRCUIT_BREAKER_MAX_BYTES_SETTING, null);
    if (compatibilityFielddataLimit != null) {
        compatibilityFielddataLimitDefault = compatibilityFielddataLimit.toString();
    }

    // This uses the old InternalCircuitBreakerService.CIRCUIT_BREAKER_OVERHEAD_SETTING
    // setting to keep backwards compatibility with 1.3, it can be safely
    // removed when compatibility with 1.3 is no longer needed
    double compatibilityFielddataOverheadDefault = DEFAULT_FIELDDATA_OVERHEAD_CONSTANT;
    Double compatibilityFielddataOverhead = settings.getAsDouble(OLD_CIRCUIT_BREAKER_OVERHEAD_SETTING, null);
    if (compatibilityFielddataOverhead != null) {
        compatibilityFielddataOverheadDefault = compatibilityFielddataOverhead;
    }

    this.fielddataSettings = new BreakerSettings(CircuitBreaker.FIELDDATA,
            settings.getAsMemory(FIELDDATA_CIRCUIT_BREAKER_LIMIT_SETTING, compatibilityFielddataLimitDefault).bytes(),
            settings.getAsDouble(FIELDDATA_CIRCUIT_BREAKER_OVERHEAD_SETTING, compatibilityFielddataOverheadDefault),
            CircuitBreaker.Type.parseValue(settings.get(FIELDDATA_CIRCUIT_BREAKER_TYPE_SETTING, DEFAULT_BREAKER_TYPE))
    );

    this.requestSettings = new BreakerSettings(CircuitBreaker.REQUEST,
            settings.getAsMemory(REQUEST_CIRCUIT_BREAKER_LIMIT_SETTING, DEFAULT_REQUEST_BREAKER_LIMIT).bytes(),
            settings.getAsDouble(REQUEST_CIRCUIT_BREAKER_OVERHEAD_SETTING, 1.0),
            CircuitBreaker.Type.parseValue(settings.get(REQUEST_CIRCUIT_BREAKER_TYPE_SETTING, DEFAULT_BREAKER_TYPE))
    );

    this.parentSettings = new BreakerSettings(CircuitBreaker.PARENT,
            settings.getAsMemory(TOTAL_CIRCUIT_BREAKER_LIMIT_SETTING, DEFAULT_TOTAL_CIRCUIT_BREAKER_LIMIT).bytes(), 1.0, CircuitBreaker.Type.PARENT);
    if (logger.isTraceEnabled()) {
        logger.trace("parent circuit breaker with settings {}", this.parentSettings);
    }

    registerBreaker(this.requestSettings);
    registerBreaker(this.fielddataSettings);

    nodeSettingsService.addListener(new ApplySettings());
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:46,代码来源:HierarchyCircuitBreakerService.java

示例8: onRefreshSettings

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
@Override
public void onRefreshSettings(Settings settings) {

    // Fielddata settings
    ByteSizeValue newFielddataMax = settings.getAsMemory(FIELDDATA_CIRCUIT_BREAKER_LIMIT_SETTING, null);
    Double newFielddataOverhead = settings.getAsDouble(FIELDDATA_CIRCUIT_BREAKER_OVERHEAD_SETTING, null);
    if (newFielddataMax != null || newFielddataOverhead != null) {
        long newFielddataLimitBytes = newFielddataMax == null ? HierarchyCircuitBreakerService.this.fielddataSettings.getLimit() : newFielddataMax.bytes();
        newFielddataOverhead = newFielddataOverhead == null ? HierarchyCircuitBreakerService.this.fielddataSettings.getOverhead() : newFielddataOverhead;

        BreakerSettings newFielddataSettings = new BreakerSettings(CircuitBreaker.FIELDDATA, newFielddataLimitBytes, newFielddataOverhead,
                HierarchyCircuitBreakerService.this.fielddataSettings.getType());
        registerBreaker(newFielddataSettings);
        HierarchyCircuitBreakerService.this.fielddataSettings = newFielddataSettings;
        logger.info("Updated breaker settings fielddata: {}", newFielddataSettings);
    }

    // Request settings
    ByteSizeValue newRequestMax = settings.getAsMemory(REQUEST_CIRCUIT_BREAKER_LIMIT_SETTING, null);
    Double newRequestOverhead = settings.getAsDouble(REQUEST_CIRCUIT_BREAKER_OVERHEAD_SETTING, null);
    if (newRequestMax != null || newRequestOverhead != null) {
        long newRequestLimitBytes = newRequestMax == null ? HierarchyCircuitBreakerService.this.requestSettings.getLimit() : newRequestMax.bytes();
        newRequestOverhead = newRequestOverhead == null ? HierarchyCircuitBreakerService.this.requestSettings.getOverhead() : newRequestOverhead;

        BreakerSettings newRequestSettings = new BreakerSettings(CircuitBreaker.REQUEST, newRequestLimitBytes, newRequestOverhead,
                HierarchyCircuitBreakerService.this.requestSettings.getType());
        registerBreaker(newRequestSettings);
        HierarchyCircuitBreakerService.this.requestSettings = newRequestSettings;
        logger.info("Updated breaker settings request: {}", newRequestSettings);
    }

    // Parent settings
    long oldParentMax = HierarchyCircuitBreakerService.this.parentSettings.getLimit();
    ByteSizeValue newParentMax = settings.getAsMemory(TOTAL_CIRCUIT_BREAKER_LIMIT_SETTING, null);
    if (newParentMax != null && (newParentMax.bytes() != oldParentMax)) {
        BreakerSettings newParentSettings = new BreakerSettings(CircuitBreaker.PARENT, newParentMax.bytes(), 1.0, CircuitBreaker.Type.PARENT);
        validateSettings(new BreakerSettings[]{newParentSettings});
        HierarchyCircuitBreakerService.this.parentSettings = newParentSettings;
        logger.info("Updated breaker settings parent: {}", newParentSettings);
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:42,代码来源:HierarchyCircuitBreakerService.java

示例9: onRefreshSettings

import org.elasticsearch.common.settings.Settings; //导入方法依赖的package包/类
@Override
public void onRefreshSettings(Settings settings) {
    final double oldExpungeDeletesPctAllowed = mergePolicy.getForceMergeDeletesPctAllowed();
    final double expungeDeletesPctAllowed = settings.getAsDouble(INDEX_MERGE_POLICY_EXPUNGE_DELETES_ALLOWED, oldExpungeDeletesPctAllowed);
    if (expungeDeletesPctAllowed != oldExpungeDeletesPctAllowed) {
        logger.info("updating [expunge_deletes_allowed] from [{}] to [{}]", oldExpungeDeletesPctAllowed, expungeDeletesPctAllowed);
        mergePolicy.setForceMergeDeletesPctAllowed(expungeDeletesPctAllowed);
    }

    final double oldFloorSegmentMB = mergePolicy.getFloorSegmentMB();
    final ByteSizeValue floorSegment = settings.getAsBytesSize(INDEX_MERGE_POLICY_FLOOR_SEGMENT, null);
    if (floorSegment != null && floorSegment.mbFrac() != oldFloorSegmentMB) {
        logger.info("updating [floor_segment] from [{}mb] to [{}]", oldFloorSegmentMB, floorSegment);
        mergePolicy.setFloorSegmentMB(floorSegment.mbFrac());
    }

    final double oldSegmentsPerTier = mergePolicy.getSegmentsPerTier();
    final double segmentsPerTier = settings.getAsDouble(INDEX_MERGE_POLICY_SEGMENTS_PER_TIER, oldSegmentsPerTier);
    if (segmentsPerTier != oldSegmentsPerTier) {
        logger.info("updating [segments_per_tier] from [{}] to [{}]", oldSegmentsPerTier, segmentsPerTier);
        mergePolicy.setSegmentsPerTier(segmentsPerTier);
    }

    final int oldMaxMergeAtOnce = mergePolicy.getMaxMergeAtOnce();
    int maxMergeAtOnce = settings.getAsInt(INDEX_MERGE_POLICY_MAX_MERGE_AT_ONCE, oldMaxMergeAtOnce);
    if (maxMergeAtOnce != oldMaxMergeAtOnce) {
        logger.info("updating [max_merge_at_once] from [{}] to [{}]", oldMaxMergeAtOnce, maxMergeAtOnce);
        maxMergeAtOnce = adjustMaxMergeAtOnceIfNeeded(maxMergeAtOnce, segmentsPerTier);
        mergePolicy.setMaxMergeAtOnce(maxMergeAtOnce);
    }

    final int oldMaxMergeAtOnceExplicit = mergePolicy.getMaxMergeAtOnceExplicit();
    final int maxMergeAtOnceExplicit = settings.getAsInt(INDEX_MERGE_POLICY_MAX_MERGE_AT_ONCE_EXPLICIT, oldMaxMergeAtOnceExplicit);
    if (maxMergeAtOnceExplicit != oldMaxMergeAtOnceExplicit) {
        logger.info("updating [max_merge_at_once_explicit] from [{}] to [{}]", oldMaxMergeAtOnceExplicit, maxMergeAtOnceExplicit);
        mergePolicy.setMaxMergeAtOnceExplicit(maxMergeAtOnceExplicit);
    }

    final double oldMaxMergedSegmentMB = mergePolicy.getMaxMergedSegmentMB();
    final ByteSizeValue maxMergedSegment = settings.getAsBytesSize(INDEX_MERGE_POLICY_MAX_MERGED_SEGMENT, null);
    if (maxMergedSegment != null && maxMergedSegment.mbFrac() != oldMaxMergedSegmentMB) {
        logger.info("updating [max_merged_segment] from [{}mb] to [{}]", oldMaxMergedSegmentMB, maxMergedSegment);
        mergePolicy.setMaxMergedSegmentMB(maxMergedSegment.mbFrac());
    }

    final double oldReclaimDeletesWeight = mergePolicy.getReclaimDeletesWeight();
    final double reclaimDeletesWeight = settings.getAsDouble(INDEX_MERGE_POLICY_RECLAIM_DELETES_WEIGHT, oldReclaimDeletesWeight);
    if (reclaimDeletesWeight != oldReclaimDeletesWeight) {
        logger.info("updating [reclaim_deletes_weight] from [{}] to [{}]", oldReclaimDeletesWeight, reclaimDeletesWeight);
        mergePolicy.setReclaimDeletesWeight(reclaimDeletesWeight);
    }

    double noCFSRatio = parseNoCFSRatio(settings.get(INDEX_COMPOUND_FORMAT, Double.toString(MergePolicyConfig.this.noCFSRatio)));
    if (noCFSRatio != MergePolicyConfig.this.noCFSRatio) {
        logger.info("updating index.compound_format from [{}] to [{}]", formatNoCFSRatio(MergePolicyConfig.this.noCFSRatio), formatNoCFSRatio(noCFSRatio));
        mergePolicy.setNoCFSRatio(noCFSRatio);
        MergePolicyConfig.this.noCFSRatio = noCFSRatio;
    }
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:60,代码来源:MergePolicyConfig.java


注:本文中的org.elasticsearch.common.settings.Settings.getAsDouble方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。