All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.taobao.drc.clusterclient.clustermanager.ExpectedConsumerStatus Maven / Gradle / Ivy

There is a newer version: 5.0.0.1.beta
Show newest version
package com.taobao.drc.clusterclient.clustermanager;

import com.alibaba.fastjson.annotation.JSONField;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * @author yangyang
 * @since 17/6/20
 */
public class ExpectedConsumerStatus {
	public static final String SEQ_SEPARATOR = ":";

	private String ip;
	private String seq;
	private String version;
	private Integer errCode;
	private String errMsg;
	@JSONField(name = "partitions")
	private List expectedPartitionStatusList = new ArrayList();

	public String getSeq() {
		return seq;
	}

	public void setSeq(String seq) {
		this.seq = seq;
	}

	public Integer getErrCode() {
		return errCode;
	}

	public void setErrCode(Integer errCode) {
		this.errCode = errCode;
	}

	public String getErrMsg() {
		return errMsg;
	}

	public void setErrMsg(String errMsg) {
		this.errMsg = errMsg;
	}

	public String getIp() {
		return ip;
	}

	public void setIp(String ip) {
		this.ip = ip;
	}

	public String getVersion() {
		return version;
	}

	public void setVersion(String version) {
		this.version = version;
	}

	public List getExpectedPartitionStatusList() {
		return expectedPartitionStatusList;
	}

	public void setExpectedPartitionStatusList(List expectedPartitionStatusList) {
		this.expectedPartitionStatusList = expectedPartitionStatusList;
	}

	public boolean isNewSeqAllocated() {
		return StringUtils.contains(seq, SEQ_SEPARATOR);
	}

	public String getLocalSeq() {
		return StringUtils.substringBefore(seq, SEQ_SEPARATOR);
	}

	public String getAllocatedSeq() {
		if (isNewSeqAllocated()) {
			return StringUtils.substringAfter(seq, SEQ_SEPARATOR);
		} else {
			throw new IllegalStateException("Invalid seq [" + seq + "]");
		}
	}

	public String toString() {
		return "ExpectedConsumerStatus:" + "ip:" + ip + ",seq:" + seq + ",version:" + version + ",errCode:" + errCode
				+ ",errMsg:" + errMsg + ",expectedPartitionStatusList size:" + expectedPartitionStatusList.size() + "";

	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy