/**
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You 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.
 */
package org.apache.activeblaze.cluster;

import org.apache.activeblaze.BlazeConfiguration;
import org.apache.activeblaze.group.BlazeGroupConfiguration;

/**
 * Configuration for a BlazeCoordinatedGroupChannel
 */
public class BlazeClusterGroupConfiguration extends BlazeGroupConfiguration {
    private long masterWeight = 0;
    private long refinedMasterWeight = 0;
    private int minimumGroupSize = 1;
    private int awaitGroupTimeout = Math.max(getHeartBeatInterval() * 2, 5000);


    /**
     * @return the masterWeight
     */
    public long getMasterWeight() {
        return this.masterWeight;
    }

    /**
     * @param masterWeight the masterWeight to set
     */
    public void setMasterWeight(long masterWeight) {
        this.masterWeight = masterWeight;
    }

    /**
     * @return the refinedMasterWeight
     */
    public long getRefinedMasterWeight() {
        return this.refinedMasterWeight;
    }

    /**
     * @param refinedMasterWeight the refinedMasterWeight to set
     */
    public void setRefinedMasterWeight(long refinedMasterWeight) {
        this.refinedMasterWeight = refinedMasterWeight;
    }

    /**
     * @return the minimumGroupSize
     */
    public int getMinimumGroupSize() {
        return this.minimumGroupSize;
    }

    /**
     * @param minimumGroupSize the minimumGroupSize to set
     */
    public void setMinimumGroupSize(int minimumGroupSize) {
        this.minimumGroupSize = minimumGroupSize;
    }

    /**
     * @return the awaitGroupTimeout
     */
    public int getAwaitGroupTimeout() {
        return this.awaitGroupTimeout;
    }

    /**
     * @param awaitGroupTimeout the awaitGroupTimeout to set
     */
    public void setAwaitGroupTimeout(int awaitGroupTimeout) {
        this.awaitGroupTimeout = awaitGroupTimeout;
    }

    protected BlazeConfiguration newInstance() {
        return new BlazeClusterGroupConfiguration();
    }
}
