public Object getFieldValue(_Fields field) { switch (field) { case HOST: return get_host(); case UPTIME_SECS: return Integer.valueOf(get_uptime_secs()); case NUM_WORKERS: return Integer.valueOf(get_num_workers()); case NUM_USED_WORKERS: return Integer.valueOf(get_num_used_workers()); } throw new IllegalStateException(); }
public SupervisorSummary deepCopy() { return new SupervisorSummary(this); }
@Override public boolean equals(Object that) { if (that == null) return false; if (that instanceof SupervisorSummary) return this.equals((SupervisorSummary)that); return false; }
/** * Performs a deep copy on <i>other</i>. */ public SupervisorSummary(SupervisorSummary other) { __isset_bitfield = other.__isset_bitfield; if (other.is_set_host()) { this.host = other.host; } if (other.is_set_supervisorId()) { this.supervisorId = other.supervisorId; } this.uptimeSecs = other.uptimeSecs; this.numWorkers = other.numWorkers; this.numUsedWorkers = other.numUsedWorkers; if (other.is_set_version()) { this.version = other.version; } if (other.is_set_buildTs()) { this.buildTs = other.buildTs; } this.port = other.port; if (other.is_set_errorMessage()) { this.errorMessage = other.errorMessage; } }
/** 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 IllegalArgumentException(); } switch (field) { case HOST: return is_set_host(); case SUPERVISOR_ID: return is_set_supervisorId(); case UPTIME_SECS: return is_set_uptimeSecs(); case NUM_WORKERS: return is_set_numWorkers(); case NUM_USED_WORKERS: return is_set_numUsedWorkers(); case VERSION: return is_set_version(); case BUILD_TS: return is_set_buildTs(); case PORT: return is_set_port(); case ERROR_MESSAGE: return is_set_errorMessage(); } throw new 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 IllegalArgumentException(); } switch (field) { case HOST: return is_set_host(); case UPTIME_SECS: return is_set_uptime_secs(); case NUM_WORKERS: return is_set_num_workers(); case NUM_USED_WORKERS: return is_set_num_used_workers(); } throw new IllegalStateException(); }
case HOST: if (value == null) { unset_host(); } else { set_host((String)value); unset_supervisorId(); } else { set_supervisorId((String)value); unset_uptimeSecs(); } else { set_uptimeSecs((Integer)value); unset_numWorkers(); } else { set_numWorkers((Integer)value); unset_numUsedWorkers(); } else { set_numUsedWorkers((Integer)value); unset_version(); } else { set_version((String)value); unset_buildTs(); } else { set_buildTs((String)value);
case HOST: if (value == null) { unset_host(); } else { set_host((String)value); unset_uptime_secs(); } else { set_uptime_secs((Integer)value); unset_num_workers(); } else { set_num_workers((Integer)value); unset_num_used_workers(); } else { set_num_used_workers((Integer)value);
case 1: // SUPERVISOR if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) { struct.supervisor = new SupervisorSummary(); struct.supervisor.read(iprot); struct.set_supervisor_isSet(true); } else {
public Object getFieldValue(_Fields field) { switch (field) { case HOST: return get_host(); case SUPERVISOR_ID: return get_supervisorId(); case UPTIME_SECS: return Integer.valueOf(get_uptimeSecs()); case NUM_WORKERS: return Integer.valueOf(get_numWorkers()); case NUM_USED_WORKERS: return Integer.valueOf(get_numUsedWorkers()); case VERSION: return get_version(); case BUILD_TS: return get_buildTs(); case PORT: return Integer.valueOf(get_port()); case ERROR_MESSAGE: return get_errorMessage(); } throw new IllegalStateException(); }
public void validate() throws org.apache.thrift.TException { // check for required fields if (!is_set_host()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'host' is unset! Struct:" + toString()); } if (!is_set_supervisorId()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'supervisorId' is unset! Struct:" + toString()); } if (!is_set_uptimeSecs()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'uptimeSecs' is unset! Struct:" + toString()); } if (!is_set_numWorkers()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'numWorkers' is unset! Struct:" + toString()); } if (!is_set_numUsedWorkers()) { throw new org.apache.thrift.protocol.TProtocolException("Required field 'numUsedWorkers' is unset! Struct:" + toString()); } // check for sub-struct validity }
public static SupervisorSummary mkSupervisorSummary(SupervisorInfo supervisorInfo, String supervisorId, Map<String, Integer> supervisorToUsedSlotNum) { Integer usedNum = supervisorToUsedSlotNum.get(supervisorId); SupervisorSummary summary = new SupervisorSummary(supervisorInfo.getHostName(), supervisorId, supervisorInfo.getUptimeSecs(), supervisorInfo.getWorkerPorts().size(), usedNum == null ? 0 : usedNum); summary.set_version(supervisorInfo.getVersion()); summary.set_buildTs(supervisorInfo.getBuildTs()); summary.set_port(supervisorInfo.getPort() != null ? supervisorInfo.getPort() : 0); summary.set_errorMessage(supervisorInfo.getErrorMessage()); return summary; }
private int getFreeSlotNum(List<SupervisorSummary> summarys) { int num = 0; for (SupervisorSummary summary : summarys) { int used = summary.get_num_used_workers(); int total = summary.get_num_workers(); int free = total - used; num += free; } return num; }
/** * Performs a deep copy on <i>other</i>. */ public SupervisorSummary(SupervisorSummary other) { __isset_bit_vector.clear(); __isset_bit_vector.or(other.__isset_bit_vector); if (other.is_set_host()) { this.host = other.host; } this.uptime_secs = other.uptime_secs; this.num_workers = other.num_workers; this.num_used_workers = other.num_used_workers; if (other.is_set_supervisor_id()) { this.supervisor_id = other.supervisor_id; } }
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, 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); } }
/** * Performs a deep copy on <i>other</i>. */ public SupervisorSummary(SupervisorSummary other) { __isset_bit_vector.clear(); __isset_bit_vector.or(other.__isset_bit_vector); if (other.is_set_host()) { this.host = other.host; } this.uptime_secs = other.uptime_secs; this.num_workers = other.num_workers; this.num_used_workers = other.num_used_workers; }
public void validate() throws org.apache.thrift7.TException { // check for required fields if (!is_set_host()) { throw new org.apache.thrift7.protocol.TProtocolException("Required field 'host' is unset! Struct:" + toString()); } if (!is_set_uptime_secs()) { throw new org.apache.thrift7.protocol.TProtocolException("Required field 'uptime_secs' is unset! Struct:" + toString()); } if (!is_set_num_workers()) { throw new org.apache.thrift7.protocol.TProtocolException("Required field 'num_workers' is unset! Struct:" + toString()); } if (!is_set_num_used_workers()) { throw new org.apache.thrift7.protocol.TProtocolException("Required field 'num_used_workers' is unset! Struct:" + toString()); } }
case HOST: if (value == null) { unset_host(); } else { set_host((String)value); unset_supervisorId(); } else { set_supervisorId((String)value); unset_uptimeSecs(); } else { set_uptimeSecs((Integer)value); unset_numWorkers(); } else { set_numWorkers((Integer)value); unset_numUsedWorkers(); } else { set_numUsedWorkers((Integer)value); unset_version(); } else { set_version((String)value); unset_buildTs(); } else { set_buildTs((String)value);
case HOST: if (value == null) { unset_host(); } else { set_host((String)value); unset_uptime_secs(); } else { set_uptime_secs((Integer)value); unset_num_workers(); } else { set_num_workers((Integer)value); unset_num_used_workers(); } else { set_num_used_workers((Integer)value); unset_supervisor_id(); } else { set_supervisor_id((String)value);