コード例 #1
0
ファイル: ThriftJobStatus.java プロジェクト: YzPaul3/ankus
  public void write(org.apache.thrift.protocol.TProtocol oprot)
      throws org.apache.thrift.TException {
    validate();

    oprot.writeStructBegin(STRUCT_DESC);
    if (this.jobID != null) {
      oprot.writeFieldBegin(JOB_ID_FIELD_DESC);
      this.jobID.write(oprot);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(MAP_PROGRESS_FIELD_DESC);
    oprot.writeDouble(this.mapProgress);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(REDUCE_PROGRESS_FIELD_DESC);
    oprot.writeDouble(this.reduceProgress);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(CLEANUP_PROGRESS_FIELD_DESC);
    oprot.writeDouble(this.cleanupProgress);
    oprot.writeFieldEnd();
    oprot.writeFieldBegin(SETUP_PROGRESS_FIELD_DESC);
    oprot.writeDouble(this.setupProgress);
    oprot.writeFieldEnd();
    if (this.runState != null) {
      oprot.writeFieldBegin(RUN_STATE_FIELD_DESC);
      oprot.writeI32(this.runState.getValue());
      oprot.writeFieldEnd();
    }
    oprot.writeFieldBegin(START_TIME_FIELD_DESC);
    oprot.writeI64(this.startTime);
    oprot.writeFieldEnd();
    if (this.user != null) {
      oprot.writeFieldBegin(USER_FIELD_DESC);
      oprot.writeString(this.user);
      oprot.writeFieldEnd();
    }
    if (this.priority != null) {
      oprot.writeFieldBegin(PRIORITY_FIELD_DESC);
      oprot.writeI32(this.priority.getValue());
      oprot.writeFieldEnd();
    }
    if (this.schedulingInfo != null) {
      oprot.writeFieldBegin(SCHEDULING_INFO_FIELD_DESC);
      oprot.writeString(this.schedulingInfo);
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }
コード例 #2
0
ファイル: ThriftJobStatus.java プロジェクト: YzPaul3/ankus
  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
    org.apache.thrift.protocol.TField field;
    iprot.readStructBegin();
    while (true) {
      field = iprot.readFieldBegin();
      if (field.type == org.apache.thrift.protocol.TType.STOP) {
        break;
      }
      switch (field.id) {
        case 1: // JOB_ID
          if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
            this.jobID = new ThriftJobID();
            this.jobID.read(iprot);
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 2: // MAP_PROGRESS
          if (field.type == org.apache.thrift.protocol.TType.DOUBLE) {
            this.mapProgress = iprot.readDouble();
            setMapProgressIsSet(true);
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 3: // REDUCE_PROGRESS
          if (field.type == org.apache.thrift.protocol.TType.DOUBLE) {
            this.reduceProgress = iprot.readDouble();
            setReduceProgressIsSet(true);
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 4: // CLEANUP_PROGRESS
          if (field.type == org.apache.thrift.protocol.TType.DOUBLE) {
            this.cleanupProgress = iprot.readDouble();
            setCleanupProgressIsSet(true);
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 5: // SETUP_PROGRESS
          if (field.type == org.apache.thrift.protocol.TType.DOUBLE) {
            this.setupProgress = iprot.readDouble();
            setSetupProgressIsSet(true);
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 6: // RUN_STATE
          if (field.type == org.apache.thrift.protocol.TType.I32) {
            this.runState = ThriftJobState.findByValue(iprot.readI32());
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 7: // START_TIME
          if (field.type == org.apache.thrift.protocol.TType.I64) {
            this.startTime = iprot.readI64();
            setStartTimeIsSet(true);
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 8: // USER
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.user = iprot.readString();
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 9: // PRIORITY
          if (field.type == org.apache.thrift.protocol.TType.I32) {
            this.priority = ThriftJobPriority.findByValue(iprot.readI32());
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 10: // SCHEDULING_INFO
          if (field.type == org.apache.thrift.protocol.TType.STRING) {
            this.schedulingInfo = iprot.readString();
          } else {
            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
          }
          break;
        default:
          org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
      }
      iprot.readFieldEnd();
    }
    iprot.readStructEnd();

    // check for required fields of primitive type, which can't be checked in the validate method
    validate();
  }