예제 #1
0
  public boolean equals(ClusterWorkerHeartbeat that) {
    if (that == null) return false;

    boolean this_present_storm_id = true && this.is_set_storm_id();
    boolean that_present_storm_id = true && that.is_set_storm_id();
    if (this_present_storm_id || that_present_storm_id) {
      if (!(this_present_storm_id && that_present_storm_id)) return false;
      if (!this.storm_id.equals(that.storm_id)) return false;
    }

    boolean this_present_executor_stats = true && this.is_set_executor_stats();
    boolean that_present_executor_stats = true && that.is_set_executor_stats();
    if (this_present_executor_stats || that_present_executor_stats) {
      if (!(this_present_executor_stats && that_present_executor_stats)) return false;
      if (!this.executor_stats.equals(that.executor_stats)) return false;
    }

    boolean this_present_time_secs = true;
    boolean that_present_time_secs = true;
    if (this_present_time_secs || that_present_time_secs) {
      if (!(this_present_time_secs && that_present_time_secs)) return false;
      if (this.time_secs != that.time_secs) return false;
    }

    boolean this_present_uptime_secs = true;
    boolean that_present_uptime_secs = true;
    if (this_present_uptime_secs || that_present_uptime_secs) {
      if (!(this_present_uptime_secs && that_present_uptime_secs)) return false;
      if (this.uptime_secs != that.uptime_secs) return false;
    }

    return true;
  }
예제 #2
0
  /** Performs a deep copy on <i>other</i>. */
  public ClusterWorkerHeartbeat(ClusterWorkerHeartbeat other) {
    __isset_bitfield = other.__isset_bitfield;
    if (other.is_set_storm_id()) {
      this.storm_id = other.storm_id;
    }
    if (other.is_set_executor_stats()) {
      Map<ExecutorInfo, ExecutorStats> __this__executor_stats =
          new HashMap<ExecutorInfo, ExecutorStats>(other.executor_stats.size());
      for (Map.Entry<ExecutorInfo, ExecutorStats> other_element : other.executor_stats.entrySet()) {

        ExecutorInfo other_element_key = other_element.getKey();
        ExecutorStats other_element_value = other_element.getValue();

        ExecutorInfo __this__executor_stats_copy_key = new ExecutorInfo(other_element_key);

        ExecutorStats __this__executor_stats_copy_value = new ExecutorStats(other_element_value);

        __this__executor_stats.put(
            __this__executor_stats_copy_key, __this__executor_stats_copy_value);
      }
      this.executor_stats = __this__executor_stats;
    }
    this.time_secs = other.time_secs;
    this.uptime_secs = other.uptime_secs;
  }
예제 #3
0
 @Override
 public void read(org.apache.thrift.protocol.TProtocol prot, ClusterWorkerHeartbeat struct)
     throws org.apache.thrift.TException {
   TTupleProtocol iprot = (TTupleProtocol) prot;
   struct.storm_id = iprot.readString();
   struct.set_storm_id_isSet(true);
   {
     org.apache.thrift.protocol.TMap _map614 =
         new org.apache.thrift.protocol.TMap(
             org.apache.thrift.protocol.TType.STRUCT,
             org.apache.thrift.protocol.TType.STRUCT,
             iprot.readI32());
     struct.executor_stats = new HashMap<ExecutorInfo, ExecutorStats>(2 * _map614.size);
     ExecutorInfo _key615;
     ExecutorStats _val616;
     for (int _i617 = 0; _i617 < _map614.size; ++_i617) {
       _key615 = new ExecutorInfo();
       _key615.read(iprot);
       _val616 = new ExecutorStats();
       _val616.read(iprot);
       struct.executor_stats.put(_key615, _val616);
     }
   }
   struct.set_executor_stats_isSet(true);
   struct.time_secs = iprot.readI32();
   struct.set_time_secs_isSet(true);
   struct.uptime_secs = iprot.readI32();
   struct.set_uptime_secs_isSet(true);
 }
예제 #4
0
    public void write(org.apache.thrift.protocol.TProtocol oprot, ClusterWorkerHeartbeat struct)
        throws org.apache.thrift.TException {
      struct.validate();

      oprot.writeStructBegin(STRUCT_DESC);
      if (struct.storm_id != null) {
        oprot.writeFieldBegin(STORM_ID_FIELD_DESC);
        oprot.writeString(struct.storm_id);
        oprot.writeFieldEnd();
      }
      if (struct.executor_stats != null) {
        oprot.writeFieldBegin(EXECUTOR_STATS_FIELD_DESC);
        {
          oprot.writeMapBegin(
              new org.apache.thrift.protocol.TMap(
                  org.apache.thrift.protocol.TType.STRUCT,
                  org.apache.thrift.protocol.TType.STRUCT,
                  struct.executor_stats.size()));
          for (Map.Entry<ExecutorInfo, ExecutorStats> _iter612 : struct.executor_stats.entrySet()) {
            _iter612.getKey().write(oprot);
            _iter612.getValue().write(oprot);
          }
          oprot.writeMapEnd();
        }
        oprot.writeFieldEnd();
      }
      oprot.writeFieldBegin(TIME_SECS_FIELD_DESC);
      oprot.writeI32(struct.time_secs);
      oprot.writeFieldEnd();
      oprot.writeFieldBegin(UPTIME_SECS_FIELD_DESC);
      oprot.writeI32(struct.uptime_secs);
      oprot.writeFieldEnd();
      oprot.writeFieldStop();
      oprot.writeStructEnd();
    }
예제 #5
0
  @Override
  public int compareTo(ClusterWorkerHeartbeat other) {
    if (!getClass().equals(other.getClass())) {
      return getClass().getName().compareTo(other.getClass().getName());
    }

    int lastComparison = 0;

    lastComparison = Boolean.valueOf(is_set_storm_id()).compareTo(other.is_set_storm_id());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (is_set_storm_id()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.storm_id, other.storm_id);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison =
        Boolean.valueOf(is_set_executor_stats()).compareTo(other.is_set_executor_stats());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (is_set_executor_stats()) {
      lastComparison =
          org.apache.thrift.TBaseHelper.compareTo(this.executor_stats, other.executor_stats);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(is_set_time_secs()).compareTo(other.is_set_time_secs());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (is_set_time_secs()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.time_secs, other.time_secs);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    lastComparison = Boolean.valueOf(is_set_uptime_secs()).compareTo(other.is_set_uptime_secs());
    if (lastComparison != 0) {
      return lastComparison;
    }
    if (is_set_uptime_secs()) {
      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.uptime_secs, other.uptime_secs);
      if (lastComparison != 0) {
        return lastComparison;
      }
    }
    return 0;
  }
예제 #6
0
 public void read(org.apache.thrift.protocol.TProtocol iprot, ClusterWorkerHeartbeat 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: // STORM_ID
         if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
           struct.storm_id = iprot.readString();
           struct.set_storm_id_isSet(true);
         } else {
           org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
         }
         break;
       case 2: // EXECUTOR_STATS
         if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
           {
             org.apache.thrift.protocol.TMap _map608 = iprot.readMapBegin();
             struct.executor_stats = new HashMap<ExecutorInfo, ExecutorStats>(2 * _map608.size);
             ExecutorInfo _key609;
             ExecutorStats _val610;
             for (int _i611 = 0; _i611 < _map608.size; ++_i611) {
               _key609 = new ExecutorInfo();
               _key609.read(iprot);
               _val610 = new ExecutorStats();
               _val610.read(iprot);
               struct.executor_stats.put(_key609, _val610);
             }
             iprot.readMapEnd();
           }
           struct.set_executor_stats_isSet(true);
         } else {
           org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
         }
         break;
       case 3: // TIME_SECS
         if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
           struct.time_secs = iprot.readI32();
           struct.set_time_secs_isSet(true);
         } else {
           org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
         }
         break;
       case 4: // UPTIME_SECS
         if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
           struct.uptime_secs = iprot.readI32();
           struct.set_uptime_secs_isSet(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();
   struct.validate();
 }