/**
* Autogenerated by Thrift Compiler (0.7.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*/
package org.apache.hadoop.corona;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Usage statistics about a resource granted to a session.
* The statistics are treated incrementally, so if a session reports
* statistics multiple times for a node, the statistics are added up
* for that node.
*/
public class NodeUsageReport implements org.apache.thrift.TBase<NodeUsageReport, NodeUsageReport._Fields>, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("NodeUsageReport");
private static final org.apache.thrift.protocol.TField NODE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("nodeName", org.apache.thrift.protocol.TType.STRING, (short)1);
private static final org.apache.thrift.protocol.TField NUM_TOTAL_TASKS_FIELD_DESC = new org.apache.thrift.protocol.TField("numTotalTasks", org.apache.thrift.protocol.TType.I32, (short)2);
private static final org.apache.thrift.protocol.TField NUM_SUCCEEDED_FIELD_DESC = new org.apache.thrift.protocol.TField("numSucceeded", org.apache.thrift.protocol.TType.I32, (short)3);
private static final org.apache.thrift.protocol.TField NUM_KILLED_FIELD_DESC = new org.apache.thrift.protocol.TField("numKilled", org.apache.thrift.protocol.TType.I32, (short)4);
private static final org.apache.thrift.protocol.TField NUM_FAILED_FIELD_DESC = new org.apache.thrift.protocol.TField("numFailed", org.apache.thrift.protocol.TType.I32, (short)5);
private static final org.apache.thrift.protocol.TField NUM_TIMEOUT_FIELD_DESC = new org.apache.thrift.protocol.TField("numTimeout", org.apache.thrift.protocol.TType.I32, (short)6);
private static final org.apache.thrift.protocol.TField NUM_SLOW_FIELD_DESC = new org.apache.thrift.protocol.TField("numSlow", org.apache.thrift.protocol.TType.I32, (short)7);
private static final org.apache.thrift.protocol.TField NUM_FAILED_CONNECTIONS_FIELD_DESC = new org.apache.thrift.protocol.TField("numFailedConnections", org.apache.thrift.protocol.TType.I32, (short)8);
public String nodeName; // required
public int numTotalTasks; // required
public int numSucceeded; // required
public int numKilled; // required
public int numFailed; // required
public int numTimeout; // required
public int numSlow; // required
public int numFailedConnections; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
NODE_NAME((short)1, "nodeName"),
NUM_TOTAL_TASKS((short)2, "numTotalTasks"),
NUM_SUCCEEDED((short)3, "numSucceeded"),
NUM_KILLED((short)4, "numKilled"),
NUM_FAILED((short)5, "numFailed"),
NUM_TIMEOUT((short)6, "numTimeout"),
NUM_SLOW((short)7, "numSlow"),
NUM_FAILED_CONNECTIONS((short)8, "numFailedConnections");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // NODE_NAME
return NODE_NAME;
case 2: // NUM_TOTAL_TASKS
return NUM_TOTAL_TASKS;
case 3: // NUM_SUCCEEDED
return NUM_SUCCEEDED;
case 4: // NUM_KILLED
return NUM_KILLED;
case 5: // NUM_FAILED
return NUM_FAILED;
case 6: // NUM_TIMEOUT
return NUM_TIMEOUT;
case 7: // NUM_SLOW
return NUM_SLOW;
case 8: // NUM_FAILED_CONNECTIONS
return NUM_FAILED_CONNECTIONS;
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 IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
private static final int __NUMTOTALTASKS_ISSET_ID = 0;
private static final int __NUMSUCCEEDED_ISSET_ID = 1;
private static final int __NUMKILLED_ISSET_ID = 2;
private static final int __NUMFAILED_ISSET_ID = 3;
private static final int __NUMTIMEOUT_ISSET_ID = 4;
private static final int __NUMSLOW_ISSET_ID = 5;
private static final int __NUMFAILEDCONNECTIONS_ISSET_ID = 6;
private BitSet __isset_bit_vector = new BitSet(7);
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.NODE_NAME, new org.apache.thrift.meta_data.FieldMetaData("nodeName", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.NUM_TOTAL_TASKS, new org.apache.thrift.meta_data.FieldMetaData("numTotalTasks", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.NUM_SUCCEEDED, new org.apache.thrift.meta_data.FieldMetaData("numSucceeded", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.NUM_KILLED, new org.apache.thrift.meta_data.FieldMetaData("numKilled", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.NUM_FAILED, new org.apache.thrift.meta_data.FieldMetaData("numFailed", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.NUM_TIMEOUT, new org.apache.thrift.meta_data.FieldMetaData("numTimeout", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.NUM_SLOW, new org.apache.thrift.meta_data.FieldMetaData("numSlow", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
tmpMap.put(_Fields.NUM_FAILED_CONNECTIONS, new org.apache.thrift.meta_data.FieldMetaData("numFailedConnections", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(NodeUsageReport.class, metaDataMap);
}
public NodeUsageReport() {
}
public NodeUsageReport(
String nodeName,
int numTotalTasks,
int numSucceeded,
int numKilled,
int numFailed,
int numTimeout,
int numSlow,
int numFailedConnections)
{
this();
this.nodeName = nodeName;
this.numTotalTasks = numTotalTasks;
setNumTotalTasksIsSet(true);
this.numSucceeded = numSucceeded;
setNumSucceededIsSet(true);
this.numKilled = numKilled;
setNumKilledIsSet(true);
this.numFailed = numFailed;
setNumFailedIsSet(true);
this.numTimeout = numTimeout;
setNumTimeoutIsSet(true);
this.numSlow = numSlow;
setNumSlowIsSet(true);
this.numFailedConnections = numFailedConnections;
setNumFailedConnectionsIsSet(true);
}
/**
* Performs a deep copy on <i>other</i>.
*/
public NodeUsageReport(NodeUsageReport other) {
__isset_bit_vector.clear();
__isset_bit_vector.or(other.__isset_bit_vector);
if (other.isSetNodeName()) {
this.nodeName = other.nodeName;
}
this.numTotalTasks = other.numTotalTasks;
this.numSucceeded = other.numSucceeded;
this.numKilled = other.numKilled;
this.numFailed = other.numFailed;
this.numTimeout = other.numTimeout;
this.numSlow = other.numSlow;
this.numFailedConnections = other.numFailedConnections;
}
public NodeUsageReport deepCopy() {
return new NodeUsageReport(this);
}
@Override
public void clear() {
this.nodeName = null;
setNumTotalTasksIsSet(false);
this.numTotalTasks = 0;
setNumSucceededIsSet(false);
this.numSucceeded = 0;
setNumKilledIsSet(false);
this.numKilled = 0;
setNumFailedIsSet(false);
this.numFailed = 0;
setNumTimeoutIsSet(false);
this.numTimeout = 0;
setNumSlowIsSet(false);
this.numSlow = 0;
setNumFailedConnectionsIsSet(false);
this.numFailedConnections = 0;
}
public String getNodeName() {
return this.nodeName;
}
public NodeUsageReport setNodeName(String nodeName) {
this.nodeName = nodeName;
return this;
}
public void unsetNodeName() {
this.nodeName = null;
}
/** Returns true if field nodeName is set (has been assigned a value) and false otherwise */
public boolean isSetNodeName() {
return this.nodeName != null;
}
public void setNodeNameIsSet(boolean value) {
if (!value) {
this.nodeName = null;
}
}
public int getNumTotalTasks() {
return this.numTotalTasks;
}
public NodeUsageReport setNumTotalTasks(int numTotalTasks) {
this.numTotalTasks = numTotalTasks;
setNumTotalTasksIsSet(true);
return this;
}
public void unsetNumTotalTasks() {
__isset_bit_vector.clear(__NUMTOTALTASKS_ISSET_ID);
}
/** Returns true if field numTotalTasks is set (has been assigned a value) and false otherwise */
public boolean isSetNumTotalTasks() {
return __isset_bit_vector.get(__NUMTOTALTASKS_ISSET_ID);
}
public void setNumTotalTasksIsSet(boolean value) {
__isset_bit_vector.set(__NUMTOTALTASKS_ISSET_ID, value);
}
public int getNumSucceeded() {
return this.numSucceeded;
}
public NodeUsageReport setNumSucceeded(int numSucceeded) {
this.numSucceeded = numSucceeded;
setNumSucceededIsSet(true);
return this;
}
public void unsetNumSucceeded() {
__isset_bit_vector.clear(__NUMSUCCEEDED_ISSET_ID);
}
/** Returns true if field numSucceeded is set (has been assigned a value) and false otherwise */
public boolean isSetNumSucceeded() {
return __isset_bit_vector.get(__NUMSUCCEEDED_ISSET_ID);
}
public void setNumSucceededIsSet(boolean value) {
__isset_bit_vector.set(__NUMSUCCEEDED_ISSET_ID, value);
}
public int getNumKilled() {
return this.numKilled;
}
public NodeUsageReport setNumKilled(int numKilled) {
this.numKilled = numKilled;
setNumKilledIsSet(true);
return this;
}
public void unsetNumKilled() {
__isset_bit_vector.clear(__NUMKILLED_ISSET_ID);
}
/** Returns true if field numKilled is set (has been assigned a value) and false otherwise */
public boolean isSetNumKilled() {
return __isset_bit_vector.get(__NUMKILLED_ISSET_ID);
}
public void setNumKilledIsSet(boolean value) {
__isset_bit_vector.set(__NUMKILLED_ISSET_ID, value);
}
public int getNumFailed() {
return this.numFailed;
}
public NodeUsageReport setNumFailed(int numFailed) {
this.numFailed = numFailed;
setNumFailedIsSet(true);
return this;
}
public void unsetNumFailed() {
__isset_bit_vector.clear(__NUMFAILED_ISSET_ID);
}
/** Returns true if field numFailed is set (has been assigned a value) and false otherwise */
public boolean isSetNumFailed() {
return __isset_bit_vector.get(__NUMFAILED_ISSET_ID);
}
public void setNumFailedIsSet(boolean value) {
__isset_bit_vector.set(__NUMFAILED_ISSET_ID, value);
}
public int getNumTimeout() {
return this.numTimeout;
}
public NodeUsageReport setNumTimeout(int numTimeout) {
this.numTimeout = numTimeout;
setNumTimeoutIsSet(true);
return this;
}
public void unsetNumTimeout() {
__isset_bit_vector.clear(__NUMTIMEOUT_ISSET_ID);
}
/** Returns true if field numTimeout is set (has been assigned a value) and false otherwise */
public boolean isSetNumTimeout() {
return __isset_bit_vector.get(__NUMTIMEOUT_ISSET_ID);
}
public void setNumTimeoutIsSet(boolean value) {
__isset_bit_vector.set(__NUMTIMEOUT_ISSET_ID, value);
}
public int getNumSlow() {
return this.numSlow;
}
public NodeUsageReport setNumSlow(int numSlow) {
this.numSlow = numSlow;
setNumSlowIsSet(true);
return this;
}
public void unsetNumSlow() {
__isset_bit_vector.clear(__NUMSLOW_ISSET_ID);
}
/** Returns true if field numSlow is set (has been assigned a value) and false otherwise */
public boolean isSetNumSlow() {
return __isset_bit_vector.get(__NUMSLOW_ISSET_ID);
}
public void setNumSlowIsSet(boolean value) {
__isset_bit_vector.set(__NUMSLOW_ISSET_ID, value);
}
public int getNumFailedConnections() {
return this.numFailedConnections;
}
public NodeUsageReport setNumFailedConnections(int numFailedConnections) {
this.numFailedConnections = numFailedConnections;
setNumFailedConnectionsIsSet(true);
return this;
}
public void unsetNumFailedConnections() {
__isset_bit_vector.clear(__NUMFAILEDCONNECTIONS_ISSET_ID);
}
/** Returns true if field numFailedConnections is set (has been assigned a value) and false otherwise */
public boolean isSetNumFailedConnections() {
return __isset_bit_vector.get(__NUMFAILEDCONNECTIONS_ISSET_ID);
}
public void setNumFailedConnectionsIsSet(boolean value) {
__isset_bit_vector.set(__NUMFAILEDCONNECTIONS_ISSET_ID, value);
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case NODE_NAME:
if (value == null) {
unsetNodeName();
} else {
setNodeName((String)value);
}
break;
case NUM_TOTAL_TASKS:
if (value == null) {
unsetNumTotalTasks();
} else {
setNumTotalTasks((Integer)value);
}
break;
case NUM_SUCCEEDED:
if (value == null) {
unsetNumSucceeded();
} else {
setNumSucceeded((Integer)value);
}
break;
case NUM_KILLED:
if (value == null) {
unsetNumKilled();
} else {
setNumKilled((Integer)value);
}
break;
case NUM_FAILED:
if (value == null) {
unsetNumFailed();
} else {
setNumFailed((Integer)value);
}
break;
case NUM_TIMEOUT:
if (value == null) {
unsetNumTimeout();
} else {
setNumTimeout((Integer)value);
}
break;
case NUM_SLOW:
if (value == null) {
unsetNumSlow();
} else {
setNumSlow((Integer)value);
}
break;
case NUM_FAILED_CONNECTIONS:
if (value == null) {
unsetNumFailedConnections();
} else {
setNumFailedConnections((Integer)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case NODE_NAME:
return getNodeName();
case NUM_TOTAL_TASKS:
return Integer.valueOf(getNumTotalTasks());
case NUM_SUCCEEDED:
return Integer.valueOf(getNumSucceeded());
case NUM_KILLED:
return Integer.valueOf(getNumKilled());
case NUM_FAILED:
return Integer.valueOf(getNumFailed());
case NUM_TIMEOUT:
return Integer.valueOf(getNumTimeout());
case NUM_SLOW:
return Integer.valueOf(getNumSlow());
case NUM_FAILED_CONNECTIONS:
return Integer.valueOf(getNumFailedConnections());
}
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 NODE_NAME:
return isSetNodeName();
case NUM_TOTAL_TASKS:
return isSetNumTotalTasks();
case NUM_SUCCEEDED:
return isSetNumSucceeded();
case NUM_KILLED:
return isSetNumKilled();
case NUM_FAILED:
return isSetNumFailed();
case NUM_TIMEOUT:
return isSetNumTimeout();
case NUM_SLOW:
return isSetNumSlow();
case NUM_FAILED_CONNECTIONS:
return isSetNumFailedConnections();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof NodeUsageReport)
return this.equals((NodeUsageReport)that);
return false;
}
public boolean equals(NodeUsageReport that) {
if (that == null)
return false;
boolean this_present_nodeName = true && this.isSetNodeName();
boolean that_present_nodeName = true && that.isSetNodeName();
if (this_present_nodeName || that_present_nodeName) {
if (!(this_present_nodeName && that_present_nodeName))
return false;
if (!this.nodeName.equals(that.nodeName))
return false;
}
boolean this_present_numTotalTasks = true;
boolean that_present_numTotalTasks = true;
if (this_present_numTotalTasks || that_present_numTotalTasks) {
if (!(this_present_numTotalTasks && that_present_numTotalTasks))
return false;
if (this.numTotalTasks != that.numTotalTasks)
return false;
}
boolean this_present_numSucceeded = true;
boolean that_present_numSucceeded = true;
if (this_present_numSucceeded || that_present_numSucceeded) {
if (!(this_present_numSucceeded && that_present_numSucceeded))
return false;
if (this.numSucceeded != that.numSucceeded)
return false;
}
boolean this_present_numKilled = true;
boolean that_present_numKilled = true;
if (this_present_numKilled || that_present_numKilled) {
if (!(this_present_numKilled && that_present_numKilled))
return false;
if (this.numKilled != that.numKilled)
return false;
}
boolean this_present_numFailed = true;
boolean that_present_numFailed = true;
if (this_present_numFailed || that_present_numFailed) {
if (!(this_present_numFailed && that_present_numFailed))
return false;
if (this.numFailed != that.numFailed)
return false;
}
boolean this_present_numTimeout = true;
boolean that_present_numTimeout = true;
if (this_present_numTimeout || that_present_numTimeout) {
if (!(this_present_numTimeout && that_present_numTimeout))
return false;
if (this.numTimeout != that.numTimeout)
return false;
}
boolean this_present_numSlow = true;
boolean that_present_numSlow = true;
if (this_present_numSlow || that_present_numSlow) {
if (!(this_present_numSlow && that_present_numSlow))
return false;
if (this.numSlow != that.numSlow)
return false;
}
boolean this_present_numFailedConnections = true;
boolean that_present_numFailedConnections = true;
if (this_present_numFailedConnections || that_present_numFailedConnections) {
if (!(this_present_numFailedConnections && that_present_numFailedConnections))
return false;
if (this.numFailedConnections != that.numFailedConnections)
return false;
}
return true;
}
@Override
public int hashCode() {
return 0;
}
public int compareTo(NodeUsageReport other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
NodeUsageReport typedOther = (NodeUsageReport)other;
lastComparison = Boolean.valueOf(isSetNodeName()).compareTo(typedOther.isSetNodeName());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetNodeName()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.nodeName, typedOther.nodeName);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetNumTotalTasks()).compareTo(typedOther.isSetNumTotalTasks());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetNumTotalTasks()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.numTotalTasks, typedOther.numTotalTasks);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetNumSucceeded()).compareTo(typedOther.isSetNumSucceeded());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetNumSucceeded()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.numSucceeded, typedOther.numSucceeded);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetNumKilled()).compareTo(typedOther.isSetNumKilled());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetNumKilled()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.numKilled, typedOther.numKilled);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetNumFailed()).compareTo(typedOther.isSetNumFailed());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetNumFailed()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.numFailed, typedOther.numFailed);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetNumTimeout()).compareTo(typedOther.isSetNumTimeout());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetNumTimeout()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.numTimeout, typedOther.numTimeout);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetNumSlow()).compareTo(typedOther.isSetNumSlow());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetNumSlow()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.numSlow, typedOther.numSlow);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetNumFailedConnections()).compareTo(typedOther.isSetNumFailedConnections());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetNumFailedConnections()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.numFailedConnections, typedOther.numFailedConnections);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
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: // NODE_NAME
if (field.type == org.apache.thrift.protocol.TType.STRING) {
this.nodeName = iprot.readString();
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
break;
case 2: // NUM_TOTAL_TASKS
if (field.type == org.apache.thrift.protocol.TType.I32) {
this.numTotalTasks = iprot.readI32();
setNumTotalTasksIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
break;
case 3: // NUM_SUCCEEDED
if (field.type == org.apache.thrift.protocol.TType.I32) {
this.numSucceeded = iprot.readI32();
setNumSucceededIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
break;
case 4: // NUM_KILLED
if (field.type == org.apache.thrift.protocol.TType.I32) {
this.numKilled = iprot.readI32();
setNumKilledIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
break;
case 5: // NUM_FAILED
if (field.type == org.apache.thrift.protocol.TType.I32) {
this.numFailed = iprot.readI32();
setNumFailedIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
break;
case 6: // NUM_TIMEOUT
if (field.type == org.apache.thrift.protocol.TType.I32) {
this.numTimeout = iprot.readI32();
setNumTimeoutIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
break;
case 7: // NUM_SLOW
if (field.type == org.apache.thrift.protocol.TType.I32) {
this.numSlow = iprot.readI32();
setNumSlowIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
break;
case 8: // NUM_FAILED_CONNECTIONS
if (field.type == org.apache.thrift.protocol.TType.I32) {
this.numFailedConnections = iprot.readI32();
setNumFailedConnectionsIsSet(true);
} 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
if (!isSetNumTotalTasks()) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'numTotalTasks' was not found in serialized data! Struct: " + toString());
}
if (!isSetNumSucceeded()) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'numSucceeded' was not found in serialized data! Struct: " + toString());
}
if (!isSetNumKilled()) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'numKilled' was not found in serialized data! Struct: " + toString());
}
if (!isSetNumFailed()) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'numFailed' was not found in serialized data! Struct: " + toString());
}
if (!isSetNumTimeout()) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'numTimeout' was not found in serialized data! Struct: " + toString());
}
if (!isSetNumSlow()) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'numSlow' was not found in serialized data! Struct: " + toString());
}
if (!isSetNumFailedConnections()) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'numFailedConnections' was not found in serialized data! Struct: " + toString());
}
validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
validate();
oprot.writeStructBegin(STRUCT_DESC);
if (this.nodeName != null) {
oprot.writeFieldBegin(NODE_NAME_FIELD_DESC);
oprot.writeString(this.nodeName);
oprot.writeFieldEnd();
}
oprot.writeFieldBegin(NUM_TOTAL_TASKS_FIELD_DESC);
oprot.writeI32(this.numTotalTasks);
oprot.writeFieldEnd();
oprot.writeFieldBegin(NUM_SUCCEEDED_FIELD_DESC);
oprot.writeI32(this.numSucceeded);
oprot.writeFieldEnd();
oprot.writeFieldBegin(NUM_KILLED_FIELD_DESC);
oprot.writeI32(this.numKilled);
oprot.writeFieldEnd();
oprot.writeFieldBegin(NUM_FAILED_FIELD_DESC);
oprot.writeI32(this.numFailed);
oprot.writeFieldEnd();
oprot.writeFieldBegin(NUM_TIMEOUT_FIELD_DESC);
oprot.writeI32(this.numTimeout);
oprot.writeFieldEnd();
oprot.writeFieldBegin(NUM_SLOW_FIELD_DESC);
oprot.writeI32(this.numSlow);
oprot.writeFieldEnd();
oprot.writeFieldBegin(NUM_FAILED_CONNECTIONS_FIELD_DESC);
oprot.writeI32(this.numFailedConnections);
oprot.writeFieldEnd();
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("NodeUsageReport(");
boolean first = true;
sb.append("nodeName:");
if (this.nodeName == null) {
sb.append("null");
} else {
sb.append(this.nodeName);
}
first = false;
if (!first) sb.append(", ");
sb.append("numTotalTasks:");
sb.append(this.numTotalTasks);
first = false;
if (!first) sb.append(", ");
sb.append("numSucceeded:");
sb.append(this.numSucceeded);
first = false;
if (!first) sb.append(", ");
sb.append("numKilled:");
sb.append(this.numKilled);
first = false;
if (!first) sb.append(", ");
sb.append("numFailed:");
sb.append(this.numFailed);
first = false;
if (!first) sb.append(", ");
sb.append("numTimeout:");
sb.append(this.numTimeout);
first = false;
if (!first) sb.append(", ");
sb.append("numSlow:");
sb.append(this.numSlow);
first = false;
if (!first) sb.append(", ");
sb.append("numFailedConnections:");
sb.append(this.numFailedConnections);
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
if (nodeName == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'nodeName' was not present! Struct: " + toString());
}
// alas, we cannot check 'numTotalTasks' because it's a primitive and you chose the non-beans generator.
// alas, we cannot check 'numSucceeded' because it's a primitive and you chose the non-beans generator.
// alas, we cannot check 'numKilled' because it's a primitive and you chose the non-beans generator.
// alas, we cannot check 'numFailed' because it's a primitive and you chose the non-beans generator.
// alas, we cannot check 'numTimeout' because it's a primitive and you chose the non-beans generator.
// alas, we cannot check 'numSlow' because it's a primitive and you chose the non-beans generator.
// alas, we cannot check 'numFailedConnections' because it's a primitive and you chose the non-beans generator.
}
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, 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_bit_vector = new BitSet(1);
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);
}
}
}