/** {@inheritDoc} */ @Override public void read(final DataInput in) throws IOException { super.read(in); this.jobVertexID.read(in); this.jobVertexName = StringRecord.readString(in); this.totalNumberOfSubtasks = in.readInt(); this.indexOfSubtask = in.readInt(); this.currentExecutionState = EnumUtils.readEnum(in, ExecutionState.class); this.description = StringRecord.readString(in); }
/** {@inheritDoc} */ @Override public void write(final DataOutput out) throws IOException { super.write(out); this.jobVertexID.write(out); StringRecord.writeString(out, this.jobVertexName); out.writeInt(this.totalNumberOfSubtasks); out.writeInt(this.indexOfSubtask); EnumUtils.writeEnum(out, this.currentExecutionState); StringRecord.writeString(out, this.description); }
public void write(DataOutput out) throws IOException { StringRecord.writeString(out, methodName); out.writeInt(parameterClasses.length); for (int i = 0; i < parameterClasses.length; i++) { StringRecord.writeString(out, parameterClasses[i].getName()); if (parameters[i] == null) { out.writeBoolean(false); } else { out.writeBoolean(true); StringRecord.writeString(out, parameters[i].getClass().getName()); parameters[i].write(out); } } }
@SuppressWarnings("unchecked") @Override public void read(DataInput in) throws IOException { final String typeClassName = StringRecord.readString(in); try { this.recordClass = (Class<T>) Class.forName(typeClassName, true, this.classLoader); } catch (ClassNotFoundException e) { throw new IOException(StringUtils.stringifyException(e)); } }
// TODO: See if type safety can be improved here @SuppressWarnings("unchecked") public void read(DataInput in) throws IOException { this.methodName = StringRecord.readString(in); this.parameters = new IOReadableWritable[in.readInt()]; this.parameterClasses = new Class[parameters.length]; for (int i = 0; i < parameters.length; i++) { // Read class name for parameter and try to get class to that name final String className = StringRecord.readString(in); try { parameterClasses[i] = ClassUtils.getRecordByName(className); } catch (ClassNotFoundException cnfe) { throw new IOException(cnfe.toString()); } // See if parameter is null if (in.readBoolean()) { try { final String parameterClassName = StringRecord.readString(in); final Class<? extends IOReadableWritable> parameterClass = ClassUtils.getRecordByName(parameterClassName); parameters[i] = parameterClass.newInstance(); } catch (IllegalAccessException iae) { throw new IOException(iae.toString()); } catch (InstantiationException ie) { throw new IOException(ie.toString()); } catch (ClassNotFoundException cnfe) { throw new IOException(cnfe.toString()); } // Object will do everything else on its own parameters[i].read(in); } else { parameters[i] = null; } } }
@Override public void write(DataOutput out) throws IOException { StringRecord.writeString(out, this.recordClass.getName()); }
/** {@inheritDoc} */ @Override public void write(final DataOutput out) throws IOException { StringRecord.writeString(out, this.protocol); }
/** {@inheritDoc} */ @Override public void read(final DataInput in) throws IOException { this.protocol = StringRecord.readString(in); }