Java Code Examples for org.elasticsearch.common.unit.TimeValue#equals()

The following examples show how to use org.elasticsearch.common.unit.TimeValue#equals() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IndicesTTLService.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void onRefreshSettings(Settings settings) {
    final TimeValue currentInterval = IndicesTTLService.this.purgerThread.getInterval();
    final TimeValue interval = settings.getAsTime(INDICES_TTL_INTERVAL,
            IndicesTTLService.this.settings.getAsTime(INDICES_TTL_INTERVAL, DEFAULT_TTL_INTERVAL));
    if (!interval.equals(currentInterval)) {
        logger.info("updating indices.ttl.interval from [{}] to [{}]",currentInterval, interval);
        IndicesTTLService.this.purgerThread.resetInterval(interval);

    }
}
 
Example 2
Source File: RecoverySettings.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
private TimeValue maybeUpdate(final TimeValue currentValue, final Settings settings, final String key, TimeValue defaultValue) {
    final TimeValue value = settings.getAsTime(key, RecoverySettings.this.settings.getAsTime(key, defaultValue));
    if (value.equals(currentValue)) {
        return currentValue;
    }
    logger.info("updating [{}] from [{}] to [{}]", key, currentValue, value);
    return value;
}
 
Example 3
Source File: SearchService.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void onRefreshSettings(Settings settings) {
    final TimeValue maybeNewDefaultSearchTimeout = settings.getAsTime(SearchService.DEFAULT_SEARCH_TIMEOUT,
            SearchService.this.settings.getAsTime(DEFAULT_SEARCH_TIMEOUT, NO_TIMEOUT));
    if (!maybeNewDefaultSearchTimeout.equals(SearchService.this.defaultSearchTimeout)) {
        logger.info("updating [{}] from [{}] to [{}]", SearchService.DEFAULT_SEARCH_TIMEOUT, SearchService.this.defaultSearchTimeout, maybeNewDefaultSearchTimeout);
        SearchService.this.defaultSearchTimeout = maybeNewDefaultSearchTimeout;
    }
}
 
Example 4
Source File: TranslogService.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void onRefreshSettings(Settings settings) {
    int flushThresholdOperations = settings.getAsInt(INDEX_TRANSLOG_FLUSH_THRESHOLD_OPS, TranslogService.this.flushThresholdOperations);
    if (flushThresholdOperations != TranslogService.this.flushThresholdOperations) {
        logger.info("updating flush_threshold_ops from [{}] to [{}]", TranslogService.this.flushThresholdOperations, flushThresholdOperations);
        TranslogService.this.flushThresholdOperations = flushThresholdOperations;
    }
    ByteSizeValue flushThresholdSize = settings.getAsBytesSize(INDEX_TRANSLOG_FLUSH_THRESHOLD_SIZE, TranslogService.this.flushThresholdSize);
    if (!flushThresholdSize.equals(TranslogService.this.flushThresholdSize)) {
        logger.info("updating flush_threshold_size from [{}] to [{}]", TranslogService.this.flushThresholdSize, flushThresholdSize);
        TranslogService.this.flushThresholdSize = flushThresholdSize;
    }
    TimeValue flushThresholdPeriod = settings.getAsTime(INDEX_TRANSLOG_FLUSH_THRESHOLD_PERIOD, TranslogService.this.flushThresholdPeriod);
    if (!flushThresholdPeriod.equals(TranslogService.this.flushThresholdPeriod)) {
        logger.info("updating flush_threshold_period from [{}] to [{}]", TranslogService.this.flushThresholdPeriod, flushThresholdPeriod);
        TranslogService.this.flushThresholdPeriod = flushThresholdPeriod;
    }
    TimeValue interval = settings.getAsTime(INDEX_TRANSLOG_FLUSH_INTERVAL, TranslogService.this.interval);
    if (!interval.equals(TranslogService.this.interval)) {
        logger.info("updating interval from [{}] to [{}]", TranslogService.this.interval, interval);
        TranslogService.this.interval = interval;
    }
    boolean disableFlush = settings.getAsBoolean(INDEX_TRANSLOG_DISABLE_FLUSH, TranslogService.this.disableFlush);
    if (disableFlush != TranslogService.this.disableFlush) {
        logger.info("updating disable_flush from [{}] to [{}]", TranslogService.this.disableFlush, disableFlush);
        TranslogService.this.disableFlush = disableFlush;
    }
}
 
Example 5
Source File: MappingUpdatedAction.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
public void onRefreshSettings(Settings settings) {
    TimeValue current = MappingUpdatedAction.this.dynamicMappingUpdateTimeout;
    TimeValue newValue = settings.getAsTime(
            INDICES_MAPPING_DYNAMIC_TIMEOUT,
            MappingUpdatedAction.this.settings.getAsTime(
                    INDICES_MAPPING_DYNAMIC_TIMEOUT,
                    DEFAULT_ADDITIONAL_MAPPING_CHANGE_TIME));
    if (!current.equals(newValue)) {
        logger.info("updating " + INDICES_MAPPING_DYNAMIC_TIMEOUT + " from [{}] to [{}]", current, newValue);
        MappingUpdatedAction.this.dynamicMappingUpdateTimeout = newValue;
    }
}