<commit_before>/*
 * Copyright 2017 Palantir Technologies, Inc. All rights reserved.
 */

package com.palantir.timelock.config;

import org.immutables.value.Value;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.google.common.base.Preconditions;

@JsonDeserialize(as = ImmutablePaxosRuntimeConfiguration.class)
@JsonSerialize(as = ImmutablePaxosRuntimeConfiguration.class)
@Value.Immutable
public interface PaxosRuntimeConfiguration {
    @JsonProperty("ping-rate-in-ms")
    @Value.Default
    default long pingRateMs() {
        return 5000L;
    }

    @JsonProperty("maximum-wait-before-proposal-in-ms")
    @Value.Default
    default long maximumWaitBeforeProposalMs() {
        return 1000L;
    }

    @JsonProperty("leader-ping-response-wait-in-ms")
    @Value.Default
    default long leaderPingResponseWaitMs() {
        return 5000L;
    }

    @JsonProperty("only-log-on-quorum-failure")
    @Value.Default
    default boolean onlyLogOnQuorumFailure() {
        return true;
    }

    default void check() {
        Preconditions.checkArgument(pingRateMs() > 0,
                "Ping rate must be positive; found '%s'.", pingRateMs());
        Preconditions.checkArgument(maximumWaitBeforeProposalMs() > 0,
                "Maximum wait before proposal must be positive; found '%s'.", maximumWaitBeforeProposalMs());
        Preconditions.checkArgument(leaderPingResponseWaitMs() > 0,
                "Leader ping response wait interval must be positive; found '%s'.", leaderPingResponseWaitMs());
    }
}<commit_msg>adding value check back<commit_after>/*
 * Copyright 2017 Palantir Technologies, Inc. All rights reserved.
 */

package com.palantir.timelock.config;

import org.immutables.value.Value;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.google.common.base.Preconditions;

@JsonDeserialize(as = ImmutablePaxosRuntimeConfiguration.class)
@JsonSerialize(as = ImmutablePaxosRuntimeConfiguration.class)
@Value.Immutable
public interface PaxosRuntimeConfiguration {
    @JsonProperty("ping-rate-in-ms")
    @Value.Default
    default long pingRateMs() {
        return 5000L;
    }

    @JsonProperty("maximum-wait-before-proposal-in-ms")
    @Value.Default
    default long maximumWaitBeforeProposalMs() {
        return 1000L;
    }

    @JsonProperty("leader-ping-response-wait-in-ms")
    @Value.Default
    default long leaderPingResponseWaitMs() {
        return 5000L;
    }

    @JsonProperty("only-log-on-quorum-failure")
    @Value.Default
    default boolean onlyLogOnQuorumFailure() {
        return true;
    }

    @Value.Check
    default void check() {
        Preconditions.checkArgument(pingRateMs() > 0,
                "Ping rate must be positive; found '%s'.", pingRateMs());
        Preconditions.checkArgument(maximumWaitBeforeProposalMs() > 0,
                "Maximum wait before proposal must be positive; found '%s'.", maximumWaitBeforeProposalMs());
        Preconditions.checkArgument(leaderPingResponseWaitMs() > 0,
                "Leader ping response wait interval must be positive; found '%s'.", leaderPingResponseWaitMs());
    }
}
{'fraction_non_alphanumeric': 0.10582323381613952, 'fraction_numerical': 0.011232633757020397, 'mean_word_length': 3.6740331491712706, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1468637', 'n_tokens_mistral': 1036, 'n_tokens_neox': 942, 'n_words': 194}