<commit_before>/*
 * (C) 2007-2012 Alibaba Group Holding Limited.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * Authors:
 *   wuhua <<EMAIL>> , boyan <<EMAIL>>
 */
package com.taobao.metamorphosis.client.consumer;

import com.taobao.metamorphosis.client.MetaClientConfig;


/**
 * ãҪѡ£
 * <ul>
 * <li>group:ƣ룬ʾڷ飬ͬһ²ظϢͬĳһtopic</li>
 * <li>consumerId: idΨһʶһߣɲãϵͳݷԶ</li>
 * <li>commitOffsetPeriodInMills: offsetʱĬ5룬λ</li>
 * <li>fetchTimeoutInMills: ͬȡϢĬϳʱʱ䣬Ĭ10룬λ</li>
 * <li>maxDelayFetchTimeInMills: ȡϢʧܵʱ򣨰get
 * missκ쳣)ӳٻȡֵӳʱ䣬λ</li>
 * <li>fetchRunnerCount: ȡϢ߳Ĭcpu</li>
 * <li>partition:ʹֱģʽʱֵָӵķ"brokerId-partition"ַ</li>
 * <li>offset:ָȡoffsetƫ,Ĭϴ0ʼ</li>
 * <li>maxFetchRetries:ͬһϢڴʧԴĬ5ΣϢ¼</li>
 * <li>maxIncreaseFetchDataRetries:ȡԴֵ,ÿȡ</li>
 * <li>loadBalanceStrategyType: ߸ؾ</li>
 * </ul>
 * 
 * @author boyan
 * @Date 2011-4-28
 * @author wuhua
 * 
 */
public class ConsumerConfig extends MetaClientConfig {
    static final long serialVersionUID = -1L;
    private int fetchRunnerCount = Runtime.getRuntime().availableProcessors();
    private long maxDelayFetchTimeInMills = 5000;
    @Deprecated
    private long maxDelayFetchTimeWhenExceptionInMills = 10000;
    private long fetchTimeoutInMills = 10000;
    private String consumerId;
    private String partition;
    private long offset = 0;
    private String group;
    private long commitOffsetPeriodInMills = 5000L;
    private int maxFetchRetries = 5;
    private boolean alwaysConsumeFromMaxOffset = false;
    private LoadBalanceStrategy.Type loadBalanceStrategyType = LoadBalanceStrategy.Type.DEFAULT;

    // ϢʧԸȡݲԷֿ,
    // ΪʱҪʧ(maxFetchRetriesΪmaxIntValue),
    // Ҫȡ
    private int maxIncreaseFetchDataRetries = 5;


    public int getMaxFetchRetries() {
        return this.maxFetchRetries;
    }


    public boolean isAlwaysConsumeFromMaxOffset() {
        return this.alwaysConsumeFromMaxOffset;
    }


    public void setMaxFetchRetries(final int maxFetchRetries) {
        this.maxFetchRetries = maxFetchRetries;
    }


    /**
     * ȡԴֵ,ÿȡ
     * 
     * @return
     */
    public int getMaxIncreaseFetchDataRetries() {
        return this.maxIncreaseFetchDataRetries;
    }


    /**
     * ȡԴֵ,ÿȡ
     * 
     * @param maxFetchRetriesForDataNotEnough
     */
    public void setMaxIncreaseFetchDataRetries(final int maxFetchRetriesForDataNotEnough) {
        this.maxIncreaseFetchDataRetries = maxFetchRetriesForDataNotEnough;
    }


    /**
     * 
     * @param group
     *            
     */
    public ConsumerConfig(final String group) {
        super();
        this.group = group;
    }


    /**
     * 
     * @param consumerId
     *            idãϵͳԶ "ip_ʱ"
     * @param group
     */
    public ConsumerConfig(final String consumerId, final String group) {
        super();
        this.consumerId = consumerId;
        this.group = group;
    }


    public ConsumerConfig() {
        super();
    }


    /**
     * ߳Ĭcpus
     * 
     * @return
     */
    public int getFetchRunnerCount() {
        return this.fetchRunnerCount;
    }


    /**
     * offset
     * 
     * @return
     */
    public long getOffset() {
        return this.offset;
    }


    /**
     * offset
     * 
     * @param offset
     */
    public void setOffset(final long offset) {
        this.offset = offset;
    }


    /**
     * ״ζǷλÿʼѡ
     * 
     * @param offset
     */
    public void setConsumeFromMaxOffset() {
        this.setConsumeFromMaxOffset(false);
    }


    /**
     * ÿζǷλÿʼѡ
     * 
     * @since 1.4.5
     * @param always
     *            ΪtrueʾÿλÿʼѡͨڲԵʱΪtrue
     */
	public void setConsumeFromMaxOffset(boolean always) {
		this.alwaysConsumeFromMaxOffset = always;
		//false ԤƲһµ
		if (always) {
			this.setOffset(Long.MAX_VALUE);
		}
	}


    /**
     * ߷
     * 
     * @return
     */
    public String getGroup() {
        return this.group;
    }


    /**
     * ߷
     * 
     * @param group
     *            Ϊ
     */<commit_msg>1.修改显示false 和预期不一致的问题<commit_after>/*
 * (C) 2007-2012 Alibaba Group Holding Limited.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * Authors:
 *   wuhua <<EMAIL>> , boyan <<EMAIL>>
 */
package com.taobao.metamorphosis.client.consumer;

import com.taobao.metamorphosis.client.MetaClientConfig;


/**
 * ãҪѡ£
 * <ul>
 * <li>group:ƣ룬ʾڷ飬ͬһ²ظϢͬĳһtopic</li>
 * <li>consumerId: idΨһʶһߣɲãϵͳݷԶ</li>
 * <li>commitOffsetPeriodInMills: offsetʱĬ5룬λ</li>
 * <li>fetchTimeoutInMills: ͬȡϢĬϳʱʱ䣬Ĭ10룬λ</li>
 * <li>maxDelayFetchTimeInMills: ȡϢʧܵʱ򣨰get
 * missκ쳣)ӳٻȡֵӳʱ䣬λ</li>
 * <li>fetchRunnerCount: ȡϢ߳Ĭcpu</li>
 * <li>partition:ʹֱģʽʱֵָӵķ"brokerId-partition"ַ</li>
 * <li>offset:ָȡoffsetƫ,Ĭϴ0ʼ</li>
 * <li>maxFetchRetries:ͬһϢڴʧԴĬ5ΣϢ¼</li>
 * <li>maxIncreaseFetchDataRetries:ȡԴֵ,ÿȡ</li>
 * <li>loadBalanceStrategyType: ߸ؾ</li>
 * </ul>
 * 
 * @author boyan
 * @Date 2011-4-28
 * @author wuhua
 * 
 */
public class ConsumerConfig extends MetaClientConfig {
    static final long serialVersionUID = -1L;
    private int fetchRunnerCount = Runtime.getRuntime().availableProcessors();
    private long maxDelayFetchTimeInMills = 5000;
    @Deprecated
    private long maxDelayFetchTimeWhenExceptionInMills = 10000;
    private long fetchTimeoutInMills = 10000;
    private String consumerId;
    private String partition;
    private long offset = 0;
    private String group;
    private long commitOffsetPeriodInMills = 5000L;
    private int maxFetchRetries = 5;
    private boolean alwaysConsumeFromMaxOffset = false;
    private LoadBalanceStrategy.Type loadBalanceStrategyType = LoadBalanceStrategy.Type.DEFAULT;

    // ϢʧԸȡݲԷֿ,
    // ΪʱҪʧ(maxFetchRetriesΪmaxIntValue),
    // Ҫȡ
    private int maxIncreaseFetchDataRetries = 5;


    public int getMaxFetchRetries() {
        return this.maxFetchRetries;
    }


    public boolean isAlwaysConsumeFromMaxOffset() {
        return this.alwaysConsumeFromMaxOffset;
    }


    public void setMaxFetchRetries(final int maxFetchRetries) {
        this.maxFetchRetries = maxFetchRetries;
    }


    /**
     * ȡԴֵ,ÿȡ
     * 
     * @return
     */
    public int getMaxIncreaseFetchDataRetries() {
        return this.maxIncreaseFetchDataRetries;
    }


    /**
     * ȡԴֵ,ÿȡ
     * 
     * @param maxFetchRetriesForDataNotEnough
     */
    public void setMaxIncreaseFetchDataRetries(final int maxFetchRetriesForDataNotEnough) {
        this.maxIncreaseFetchDataRetries = maxFetchRetriesForDataNotEnough;
    }


    /**
     * 
     * @param group
     *            
     */
    public ConsumerConfig(final String group) {
        super();
        this.group = group;
    }


    /**
     * 
     * @param consumerId
     *            idãϵͳԶ "ip_ʱ"
     * @param group
     */
    public ConsumerConfig(final String consumerId, final String group) {
        super();
        this.consumerId = consumerId;
        this.group = group;
    }


    public ConsumerConfig() {
        super();
    }


    /**
     * ߳Ĭcpus
     * 
     * @return
     */
    public int getFetchRunnerCount() {
        return this.fetchRunnerCount;
    }


    /**
     * offset
     * 
     * @return
     */
    public long getOffset() {
        return this.offset;
    }


    /**
     * offset
     * 
     * @param offset
     */
    public void setOffset(final long offset) {
        this.offset = offset;
    }


    /**
     * ״ζǷλÿʼѡ
     * 
     * @param offset
     */
    public void setConsumeFromMaxOffset() {
        this.setConsumeFromMaxOffset(false);
    }


    /**
     * ÿζǷλÿʼѡ
     * 
     * @since 1.4.5
     * @param always
     *            ΪtrueʾÿλÿʼѡͨڲԵʱΪtrue
     */
    public void setConsumeFromMaxOffset(boolean always) {
        this.alwaysConsumeFromMaxOffset = always;
        // false ԤƲһµ
        if (always) {
            this.setOffset(Long.MAX_VALUE);
        } 
    }

    /**
     * ߷
     * 
     * @return
     */
    public String getGroup() {
        return this.group;
    }


    /**
     * ߷
     * 
     * @param group
     *            Ϊ
     */
{'fraction_non_alphanumeric': 0.10519884470117752, 'fraction_numerical': 0.010997556098644745, 'mean_word_length': 2.4297142857142857, 'pattern_counts': {'":': 0, '<': 59, '<?xml version=': 0, '>': 59, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, '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': '424608', 'n_tokens_mistral': 3377, 'n_tokens_neox': 3243, 'n_words': 615}