TReplicaInfo.java

/**
 * Autogenerated by Thrift Compiler (0.16.0)
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */
package org.apache.doris.thrift;

@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"})
@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.16.0)", date = "2026-05-14")
public class TReplicaInfo implements org.apache.thrift.TBase<TReplicaInfo, TReplicaInfo._Fields>, java.io.Serializable, Cloneable, Comparable<TReplicaInfo> {
  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TReplicaInfo");

  private static final org.apache.thrift.protocol.TField HOST_FIELD_DESC = new org.apache.thrift.protocol.TField("host", org.apache.thrift.protocol.TType.STRING, (short)1);
  private static final org.apache.thrift.protocol.TField BE_PORT_FIELD_DESC = new org.apache.thrift.protocol.TField("be_port", org.apache.thrift.protocol.TType.I32, (short)2);
  private static final org.apache.thrift.protocol.TField HTTP_PORT_FIELD_DESC = new org.apache.thrift.protocol.TField("http_port", org.apache.thrift.protocol.TType.I32, (short)3);
  private static final org.apache.thrift.protocol.TField BRPC_PORT_FIELD_DESC = new org.apache.thrift.protocol.TField("brpc_port", org.apache.thrift.protocol.TType.I32, (short)4);
  private static final org.apache.thrift.protocol.TField REPLICA_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("replica_id", org.apache.thrift.protocol.TType.I64, (short)5);
  private static final org.apache.thrift.protocol.TField IS_ALIVE_FIELD_DESC = new org.apache.thrift.protocol.TField("is_alive", org.apache.thrift.protocol.TType.BOOL, (short)6);
  private static final org.apache.thrift.protocol.TField BACKEND_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("backend_id", org.apache.thrift.protocol.TType.I64, (short)7);

  private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new TReplicaInfoStandardSchemeFactory();
  private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new TReplicaInfoTupleSchemeFactory();

  public @org.apache.thrift.annotation.Nullable java.lang.String host; // required
  public int be_port; // required
  public int http_port; // required
  public int brpc_port; // required
  public long replica_id; // required
  public boolean is_alive; // optional
  public long backend_id; // optional

  /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
  public enum _Fields implements org.apache.thrift.TFieldIdEnum {
    HOST((short)1, "host"),
    BE_PORT((short)2, "be_port"),
    HTTP_PORT((short)3, "http_port"),
    BRPC_PORT((short)4, "brpc_port"),
    REPLICA_ID((short)5, "replica_id"),
    IS_ALIVE((short)6, "is_alive"),
    BACKEND_ID((short)7, "backend_id");

    private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();

    static {
      for (_Fields field : java.util.EnumSet.allOf(_Fields.class)) {
        byName.put(field.getFieldName(), field);
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByThriftId(int fieldId) {
      switch(fieldId) {
        case 1: // HOST
          return HOST;
        case 2: // BE_PORT
          return BE_PORT;
        case 3: // HTTP_PORT
          return HTTP_PORT;
        case 4: // BRPC_PORT
          return BRPC_PORT;
        case 5: // REPLICA_ID
          return REPLICA_ID;
        case 6: // IS_ALIVE
          return IS_ALIVE;
        case 7: // BACKEND_ID
          return BACKEND_ID;
        default:
          return null;
      }
    }

    /**
     * Find the _Fields constant that matches fieldId, throwing an exception
     * if it is not found.
     */
    public static _Fields findByThriftIdOrThrow(int fieldId) {
      _Fields fields = findByThriftId(fieldId);
      if (fields == null) throw new java.lang.IllegalArgumentException("Field " + fieldId + " doesn't exist!");
      return fields;
    }

    /**
     * Find the _Fields constant that matches name, or null if its not found.
     */
    @org.apache.thrift.annotation.Nullable
    public static _Fields findByName(java.lang.String name) {
      return byName.get(name);
    }

    private final short _thriftId;
    private final java.lang.String _fieldName;

    _Fields(short thriftId, java.lang.String fieldName) {
      _thriftId = thriftId;
      _fieldName = fieldName;
    }

    public short getThriftFieldId() {
      return _thriftId;
    }

    public java.lang.String getFieldName() {
      return _fieldName;
    }
  }

  // isset id assignments
  private static final int __BE_PORT_ISSET_ID = 0;
  private static final int __HTTP_PORT_ISSET_ID = 1;
  private static final int __BRPC_PORT_ISSET_ID = 2;
  private static final int __REPLICA_ID_ISSET_ID = 3;
  private static final int __IS_ALIVE_ISSET_ID = 4;
  private static final int __BACKEND_ID_ISSET_ID = 5;
  private byte __isset_bitfield = 0;
  private static final _Fields optionals[] = {_Fields.IS_ALIVE,_Fields.BACKEND_ID};
  public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
  static {
    java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
    tmpMap.put(_Fields.HOST, new org.apache.thrift.meta_data.FieldMetaData("host", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
    tmpMap.put(_Fields.BE_PORT, new org.apache.thrift.meta_data.FieldMetaData("be_port", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32        , "TPort")));
    tmpMap.put(_Fields.HTTP_PORT, new org.apache.thrift.meta_data.FieldMetaData("http_port", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32        , "TPort")));
    tmpMap.put(_Fields.BRPC_PORT, new org.apache.thrift.meta_data.FieldMetaData("brpc_port", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32        , "TPort")));
    tmpMap.put(_Fields.REPLICA_ID, new org.apache.thrift.meta_data.FieldMetaData("replica_id", org.apache.thrift.TFieldRequirementType.REQUIRED, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64        , "TReplicaId")));
    tmpMap.put(_Fields.IS_ALIVE, new org.apache.thrift.meta_data.FieldMetaData("is_alive", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
    tmpMap.put(_Fields.BACKEND_ID, new org.apache.thrift.meta_data.FieldMetaData("backend_id", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
    metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TReplicaInfo.class, metaDataMap);
  }

  public TReplicaInfo() {
  }

  public TReplicaInfo(
    java.lang.String host,
    int be_port,
    int http_port,
    int brpc_port,
    long replica_id)
  {
    this();
    this.host = host;
    this.be_port = be_port;
    setBePortIsSet(true);
    this.http_port = http_port;
    setHttpPortIsSet(true);
    this.brpc_port = brpc_port;
    setBrpcPortIsSet(true);
    this.replica_id = replica_id;
    setReplicaIdIsSet(true);
  }

  /**
   * Performs a deep copy on <i>other</i>.
   */
  public TReplicaInfo(TReplicaInfo other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.isSetHost()) {
      this.host = other.host;
    }
    this.be_port = other.be_port;
    this.http_port = other.http_port;
    this.brpc_port = other.brpc_port;
    this.replica_id = other.replica_id;
    this.is_alive = other.is_alive;
    this.backend_id = other.backend_id;
  }

  public TReplicaInfo deepCopy() {
    return new TReplicaInfo(this);
  }

  @Override
  public void clear() {
    this.host = null;
    setBePortIsSet(false);
    this.be_port = 0;
    setHttpPortIsSet(false);
    this.http_port = 0;
    setBrpcPortIsSet(false);
    this.brpc_port = 0;
    setReplicaIdIsSet(false);
    this.replica_id = 0;
    setIsAliveIsSet(false);
    this.is_alive = false;
    setBackendIdIsSet(false);
    this.backend_id = 0;
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.String getHost() {
    return this.host;
  }

  public TReplicaInfo setHost(@org.apache.thrift.annotation.Nullable java.lang.String host) {
    this.host = host;
    return this;
  }

  public void unsetHost() {
    this.host = null;
  }

  /** Returns true if field host is set (has been assigned a value) and false otherwise */
  public boolean isSetHost() {
    return this.host != null;
  }

  public void setHostIsSet(boolean value) {
    if (!value) {
      this.host = null;
    }
  }

  public int getBePort() {
    return this.be_port;
  }

  public TReplicaInfo setBePort(int be_port) {
    this.be_port = be_port;
    setBePortIsSet(true);
    return this;
  }

  public void unsetBePort() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __BE_PORT_ISSET_ID);
  }

  /** Returns true if field be_port is set (has been assigned a value) and false otherwise */
  public boolean isSetBePort() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __BE_PORT_ISSET_ID);
  }

  public void setBePortIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __BE_PORT_ISSET_ID, value);
  }

  public int getHttpPort() {
    return this.http_port;
  }

  public TReplicaInfo setHttpPort(int http_port) {
    this.http_port = http_port;
    setHttpPortIsSet(true);
    return this;
  }

  public void unsetHttpPort() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __HTTP_PORT_ISSET_ID);
  }

  /** Returns true if field http_port is set (has been assigned a value) and false otherwise */
  public boolean isSetHttpPort() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __HTTP_PORT_ISSET_ID);
  }

  public void setHttpPortIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __HTTP_PORT_ISSET_ID, value);
  }

  public int getBrpcPort() {
    return this.brpc_port;
  }

  public TReplicaInfo setBrpcPort(int brpc_port) {
    this.brpc_port = brpc_port;
    setBrpcPortIsSet(true);
    return this;
  }

  public void unsetBrpcPort() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __BRPC_PORT_ISSET_ID);
  }

  /** Returns true if field brpc_port is set (has been assigned a value) and false otherwise */
  public boolean isSetBrpcPort() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __BRPC_PORT_ISSET_ID);
  }

  public void setBrpcPortIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __BRPC_PORT_ISSET_ID, value);
  }

  public long getReplicaId() {
    return this.replica_id;
  }

  public TReplicaInfo setReplicaId(long replica_id) {
    this.replica_id = replica_id;
    setReplicaIdIsSet(true);
    return this;
  }

  public void unsetReplicaId() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __REPLICA_ID_ISSET_ID);
  }

  /** Returns true if field replica_id is set (has been assigned a value) and false otherwise */
  public boolean isSetReplicaId() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __REPLICA_ID_ISSET_ID);
  }

  public void setReplicaIdIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __REPLICA_ID_ISSET_ID, value);
  }

  public boolean isIsAlive() {
    return this.is_alive;
  }

  public TReplicaInfo setIsAlive(boolean is_alive) {
    this.is_alive = is_alive;
    setIsAliveIsSet(true);
    return this;
  }

  public void unsetIsAlive() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __IS_ALIVE_ISSET_ID);
  }

  /** Returns true if field is_alive is set (has been assigned a value) and false otherwise */
  public boolean isSetIsAlive() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __IS_ALIVE_ISSET_ID);
  }

  public void setIsAliveIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __IS_ALIVE_ISSET_ID, value);
  }

  public long getBackendId() {
    return this.backend_id;
  }

  public TReplicaInfo setBackendId(long backend_id) {
    this.backend_id = backend_id;
    setBackendIdIsSet(true);
    return this;
  }

  public void unsetBackendId() {
    __isset_bitfield = org.apache.thrift.EncodingUtils.clearBit(__isset_bitfield, __BACKEND_ID_ISSET_ID);
  }

  /** Returns true if field backend_id is set (has been assigned a value) and false otherwise */
  public boolean isSetBackendId() {
    return org.apache.thrift.EncodingUtils.testBit(__isset_bitfield, __BACKEND_ID_ISSET_ID);
  }

  public void setBackendIdIsSet(boolean value) {
    __isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __BACKEND_ID_ISSET_ID, value);
  }

  public void setFieldValue(_Fields field, @org.apache.thrift.annotation.Nullable java.lang.Object value) {
    switch (field) {
    case HOST:
      if (value == null) {
        unsetHost();
      } else {
        setHost((java.lang.String)value);
      }
      break;

    case BE_PORT:
      if (value == null) {
        unsetBePort();
      } else {
        setBePort((java.lang.Integer)value);
      }
      break;

    case HTTP_PORT:
      if (value == null) {
        unsetHttpPort();
      } else {
        setHttpPort((java.lang.Integer)value);
      }
      break;

    case BRPC_PORT:
      if (value == null) {
        unsetBrpcPort();
      } else {
        setBrpcPort((java.lang.Integer)value);
      }
      break;

    case REPLICA_ID:
      if (value == null) {
        unsetReplicaId();
      } else {
        setReplicaId((java.lang.Long)value);
      }
      break;

    case IS_ALIVE:
      if (value == null) {
        unsetIsAlive();
      } else {
        setIsAlive((java.lang.Boolean)value);
      }
      break;

    case BACKEND_ID:
      if (value == null) {
        unsetBackendId();
      } else {
        setBackendId((java.lang.Long)value);
      }
      break;

    }
  }

  @org.apache.thrift.annotation.Nullable
  public java.lang.Object getFieldValue(_Fields field) {
    switch (field) {
    case HOST:
      return getHost();

    case BE_PORT:
      return getBePort();

    case HTTP_PORT:
      return getHttpPort();

    case BRPC_PORT:
      return getBrpcPort();

    case REPLICA_ID:
      return getReplicaId();

    case IS_ALIVE:
      return isIsAlive();

    case BACKEND_ID:
      return getBackendId();

    }
    throw new java.lang.IllegalStateException();
  }

  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
  public boolean isSet(_Fields field) {
    if (field == null) {
      throw new java.lang.IllegalArgumentException();
    }

    switch (field) {
    case HOST:
      return isSetHost();
    case BE_PORT:
      return isSetBePort();
    case HTTP_PORT:
      return isSetHttpPort();
    case BRPC_PORT:
      return isSetBrpcPort();
    case REPLICA_ID:
      return isSetReplicaId();
    case IS_ALIVE:
      return isSetIsAlive();
    case BACKEND_ID:
      return isSetBackendId();
    }
    throw new java.lang.IllegalStateException();
  }

  @Override
  public boolean equals(java.lang.Object that) {
    if (that instanceof TReplicaInfo)
      return this.equals((TReplicaInfo)that);
    return false;
  }

  public boolean equals(TReplicaInfo that) {
    if (that == null)
      return false;
    if (this == that)
      return true;

    boolean this_present_host = true && this.isSetHost();
    boolean that_present_host = true && that.isSetHost();
    if (this_present_host || that_present_host) {
      if (!(this_present_host && that_present_host))
        return false;
      if (!this.host.equals(that.host))
        return false;
    }

    boolean this_present_be_port = true;
    boolean that_present_be_port = true;
    if (this_present_be_port || that_present_be_port) {
      if (!(this_present_be_port && that_present_be_port))
        return false;
      if (this.be_port != that.be_port)
        return false;
    }

    boolean this_present_http_port = true;
    boolean that_present_http_port = true;
    if (this_present_http_port || that_present_http_port) {
      if (!(this_present_http_port && that_present_http_port))
        return false;
      if (this.http_port != that.http_port)
        return false;
    }

    boolean this_present_brpc_port = true;
    boolean that_present_brpc_port = true;
    if (this_present_brpc_port || that_present_brpc_port) {
      if (!(this_present_brpc_port && that_present_brpc_port))
        return false;
      if (this.brpc_port != that.brpc_port)
        return false;
    }

    boolean this_present_replica_id = true;
    boolean that_present_replica_id = true;
    if (this_present_replica_id || that_present_replica_id) {
      if (!(this_present_replica_id && that_present_replica_id))
        return false;
      if (this.replica_id != that.replica_id)
        return false;
    }

    boolean this_present_is_alive = true && this.isSetIsAlive();
    boolean that_present_is_alive = true && that.isSetIsAlive();
    if (this_present_is_alive || that_present_is_alive) {
      if (!(this_present_is_alive && that_present_is_alive))
        return false;
      if (this.is_alive != that.is_alive)
        return false;
    }

    boolean this_present_backend_id = true && this.isSetBackendId();
    boolean that_present_backend_id = true && that.isSetBackendId();
    if (this_present_backend_id || that_present_backend_id) {
      if (!(this_present_backend_id && that_present_backend_id))
        return false;
      if (this.backend_id != that.backend_id)
        return false;
    }

    return true;
  }

  @Override
  public int hashCode() {
    int hashCode = 1;

    hashCode = hashCode * 8191 + ((isSetHost()) ? 131071 : 524287);
    if (isSetHost())
      hashCode = hashCode * 8191 + host.hashCode();

    hashCode = hashCode * 8191 + be_port;

    hashCode = hashCode * 8191 + http_port;

    hashCode = hashCode * 8191 + brpc_port;

    hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(replica_id);

    hashCode = hashCode * 8191 + ((isSetIsAlive()) ? 131071 : 524287);
    if (isSetIsAlive())
      hashCode = hashCode * 8191 + ((is_alive) ? 131071 : 524287);

    hashCode = hashCode * 8191 + ((isSetBackendId()) ? 131071 : 524287);
    if (isSetBackendId())
      hashCode = hashCode * 8191 + org.apache.thrift.TBaseHelper.hashCode(backend_id);

    return hashCode;
  }

  @Override
  public int compareTo(TReplicaInfo other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = java.lang.Boolean.compare(isSetHost(), other.isSetHost());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetHost()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.host, other.host);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetBePort(), other.isSetBePort());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBePort()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.be_port, other.be_port);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetHttpPort(), other.isSetHttpPort());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetHttpPort()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.http_port, other.http_port);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetBrpcPort(), other.isSetBrpcPort());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBrpcPort()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.brpc_port, other.brpc_port);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetReplicaId(), other.isSetReplicaId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetReplicaId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.replica_id, other.replica_id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetIsAlive(), other.isSetIsAlive());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetIsAlive()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.is_alive, other.is_alive);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = java.lang.Boolean.compare(isSetBackendId(), other.isSetBackendId());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (isSetBackendId()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.backend_id, other.backend_id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }

  @org.apache.thrift.annotation.Nullable
  public _Fields fieldForId(int fieldId) {
    return _Fields.findByThriftId(fieldId);
  }

  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    scheme(iprot).read(iprot, this);
  }

  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
    scheme(oprot).write(oprot, this);
  }

  @Override
  public java.lang.String toString() {
    java.lang.StringBuilder sb = new java.lang.StringBuilder("TReplicaInfo(");
    boolean first = true;

    sb.append("host:");
    if (this.host == null) {
      sb.append("null");
    } else {
      sb.append(this.host);
    }
    first = false;
    if (!first) sb.append(", ");
    sb.append("be_port:");
    sb.append(this.be_port);
    first = false;
    if (!first) sb.append(", ");
    sb.append("http_port:");
    sb.append(this.http_port);
    first = false;
    if (!first) sb.append(", ");
    sb.append("brpc_port:");
    sb.append(this.brpc_port);
    first = false;
    if (!first) sb.append(", ");
    sb.append("replica_id:");
    sb.append(this.replica_id);
    first = false;
    if (isSetIsAlive()) {
      if (!first) sb.append(", ");
      sb.append("is_alive:");
      sb.append(this.is_alive);
      first = false;
    }
    if (isSetBackendId()) {
      if (!first) sb.append(", ");
      sb.append("backend_id:");
      sb.append(this.backend_id);
      first = false;
    }
    sb.append(")");
    return sb.toString();
  }

  public void validate() throws org.apache.thrift.TException {
    // check for required fields
    if (host == null) {
      throw new org.apache.thrift.protocol.TProtocolException("Required field 'host' was not present! Struct: " + toString());
    }
    // alas, we cannot check 'be_port' because it's a primitive and you chose the non-beans generator.
    // alas, we cannot check 'http_port' because it's a primitive and you chose the non-beans generator.
    // alas, we cannot check 'brpc_port' because it's a primitive and you chose the non-beans generator.
    // alas, we cannot check 'replica_id' because it's a primitive and you chose the non-beans generator.
    // check for sub-struct validity
  }

  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
    try {
      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException {
    try {
      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
      __isset_bitfield = 0;
      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
    } catch (org.apache.thrift.TException te) {
      throw new java.io.IOException(te);
    }
  }

  private static class TReplicaInfoStandardSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public TReplicaInfoStandardScheme getScheme() {
      return new TReplicaInfoStandardScheme();
    }
  }

  private static class TReplicaInfoStandardScheme extends org.apache.thrift.scheme.StandardScheme<TReplicaInfo> {

    public void read(org.apache.thrift.protocol.TProtocol iprot, TReplicaInfo struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TField schemeField;
      iprot.readStructBegin();
      while (true)
      {
        schemeField = iprot.readFieldBegin();
        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
          break;
        }
        switch (schemeField.id) {
          case 1: // HOST
            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
              struct.host = iprot.readString();
              struct.setHostIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 2: // BE_PORT
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.be_port = iprot.readI32();
              struct.setBePortIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 3: // HTTP_PORT
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.http_port = iprot.readI32();
              struct.setHttpPortIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 4: // BRPC_PORT
            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
              struct.brpc_port = iprot.readI32();
              struct.setBrpcPortIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 5: // REPLICA_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.replica_id = iprot.readI64();
              struct.setReplicaIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 6: // IS_ALIVE
            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
              struct.is_alive = iprot.readBool();
              struct.setIsAliveIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          case 7: // BACKEND_ID
            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
              struct.backend_id = iprot.readI64();
              struct.setBackendIdIsSet(true);
            } else { 
              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
            }
            break;
          default:
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
        }
        iprot.readFieldEnd();
      }
      iprot.readStructEnd();

      // check for required fields of primitive type, which can't be checked in the validate method
      if (!struct.isSetBePort()) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'be_port' was not found in serialized data! Struct: " + toString());
      }
      if (!struct.isSetHttpPort()) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'http_port' was not found in serialized data! Struct: " + toString());
      }
      if (!struct.isSetBrpcPort()) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'brpc_port' was not found in serialized data! Struct: " + toString());
      }
      if (!struct.isSetReplicaId()) {
        throw new org.apache.thrift.protocol.TProtocolException("Required field 'replica_id' was not found in serialized data! Struct: " + toString());
      }
      struct.validate();
    }

    public void write(org.apache.thrift.protocol.TProtocol oprot, TReplicaInfo struct) throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.host != null) {
        oprot.writeFieldBegin(HOST_FIELD_DESC);
        oprot.writeString(struct.host);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(BE_PORT_FIELD_DESC);
      oprot.writeI32(struct.be_port);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(HTTP_PORT_FIELD_DESC);
      oprot.writeI32(struct.http_port);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(BRPC_PORT_FIELD_DESC);
      oprot.writeI32(struct.brpc_port);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(REPLICA_ID_FIELD_DESC);
      oprot.writeI64(struct.replica_id);
      oprot.writeFieldEnd();
      if (struct.isSetIsAlive()) {
        oprot.writeFieldBegin(IS_ALIVE_FIELD_DESC);
        oprot.writeBool(struct.is_alive);
        oprot.writeFieldEnd();
      }
      if (struct.isSetBackendId()) {
        oprot.writeFieldBegin(BACKEND_ID_FIELD_DESC);
        oprot.writeI64(struct.backend_id);
        oprot.writeFieldEnd();
      }
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }

  }

  private static class TReplicaInfoTupleSchemeFactory implements org.apache.thrift.scheme.SchemeFactory {
    public TReplicaInfoTupleScheme getScheme() {
      return new TReplicaInfoTupleScheme();
    }
  }

  private static class TReplicaInfoTupleScheme extends org.apache.thrift.scheme.TupleScheme<TReplicaInfo> {

    @Override
    public void write(org.apache.thrift.protocol.TProtocol prot, TReplicaInfo struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol oprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      oprot.writeString(struct.host);
      oprot.writeI32(struct.be_port);
      oprot.writeI32(struct.http_port);
      oprot.writeI32(struct.brpc_port);
      oprot.writeI64(struct.replica_id);
      java.util.BitSet optionals = new java.util.BitSet();
      if (struct.isSetIsAlive()) {
        optionals.set(0);
      }
      if (struct.isSetBackendId()) {
        optionals.set(1);
      }
      oprot.writeBitSet(optionals, 2);
      if (struct.isSetIsAlive()) {
        oprot.writeBool(struct.is_alive);
      }
      if (struct.isSetBackendId()) {
        oprot.writeI64(struct.backend_id);
      }
    }

    @Override
    public void read(org.apache.thrift.protocol.TProtocol prot, TReplicaInfo struct) throws org.apache.thrift.TException {
      org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;
      struct.host = iprot.readString();
      struct.setHostIsSet(true);
      struct.be_port = iprot.readI32();
      struct.setBePortIsSet(true);
      struct.http_port = iprot.readI32();
      struct.setHttpPortIsSet(true);
      struct.brpc_port = iprot.readI32();
      struct.setBrpcPortIsSet(true);
      struct.replica_id = iprot.readI64();
      struct.setReplicaIdIsSet(true);
      java.util.BitSet incoming = iprot.readBitSet(2);
      if (incoming.get(0)) {
        struct.is_alive = iprot.readBool();
        struct.setIsAliveIsSet(true);
      }
      if (incoming.get(1)) {
        struct.backend_id = iprot.readI64();
        struct.setBackendIdIsSet(true);
      }
    }
  }

  private static <S extends org.apache.thrift.scheme.IScheme> S scheme(org.apache.thrift.protocol.TProtocol proto) {
    return (org.apache.thrift.scheme.StandardScheme.class.equals(proto.getScheme()) ? STANDARD_SCHEME_FACTORY : TUPLE_SCHEME_FACTORY).getScheme();
  }
}