List of usage examples for org.apache.hadoop.io WritableUtils writeEnum
public static void writeEnum(DataOutput out, Enum<?> enumVal) throws IOException
From source file:co.cask.cdap.data2.transaction.queue.hbase.DequeueScanAttributes.java
License:Apache License
public static void write(DataOutput dataOutput, ConsumerConfig consumerConfig) throws IOException { dataOutput.writeLong(consumerConfig.getGroupId()); dataOutput.writeInt(consumerConfig.getGroupSize()); dataOutput.writeInt(consumerConfig.getInstanceId()); WritableUtils.writeEnum(dataOutput, consumerConfig.getDequeueStrategy()); WritableUtils.writeString(dataOutput, consumerConfig.getHashKey()); }
From source file:com.chinamobile.bcbsp.action.Directive.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { out.writeInt(faultSSStep);//from w w w.ja va 2 s .co m out.writeLong(this.timestamp); out.writeInt(this.type.value()); if (getType().value() == Directive.Type.Request.value()) { if (this.actionList == null) { WritableUtils.writeVInt(out, 0); } else { WritableUtils.writeVInt(out, actionList.size()); for (WorkerManagerAction action : this.actionList) { WritableUtils.writeEnum(out, action.getActionType()); action.write(out); } } WritableUtils.writeCompressedStringArray(out, this.workerManagersName); } else if (getType().value() == Directive.Type.Response.value()) { this.status.write(out); } else { throw new IllegalStateException("Wrong directive type:" + getType()); } /* Zhicheng Liu added */ out.writeInt(this.migrateSSStep); }
From source file:com.chinamobile.bcbsp.bspcontroller.ClusterStatus.java
License:Apache License
/** * rewrite the write method to write the information into hdfs. * @param out// ww w . ja v a 2 s. co m * DataOutput object to handle hdfs. */ @Override public void write(DataOutput out) throws IOException { out.writeInt(this.activeWorkerManagersCount); if (this.activeWorkerManagersCount == 0) { out.writeBoolean(false); } else { out.writeBoolean(true); WritableUtils.writeCompressedStringArray(out, this.activeWorkerManagersName); } out.writeInt(this.maxClusterStaffs); out.writeInt(this.runningClusterStaffs); WritableUtils.writeEnum(out, this.state); }
From source file:com.chinamobile.bcbsp.fault.storage.Fault.java
License:Apache License
/** * write fault information./*from w w w.j a v a 2 s. co m*/ * @param out * data to output. */ @Override public void write(DataOutput out) throws IOException { WritableUtils.writeEnum(out, this.type); WritableUtils.writeEnum(out, this.level); Text.writeString(out, this.timeOfFailure); Text.writeString(out, this.workerNodeName); Text.writeString(out, this.jobName); Text.writeString(out, this.staffName); Text.writeString(out, this.exceptionMessage); out.writeInt(this.superStep_Stage); }
From source file:com.chinamobile.bcbsp.util.JobStatus.java
License:Apache License
/** serialize * write this object to out.//w ww . ja v a 2 s . c om * * @param out Writes to the output stream. */ @Override public synchronized void write(DataOutput out) throws IOException { jobid.write(out); out.writeLong(setupProgress); out.writeLong(progress); out.writeLong(cleanupProgress); out.writeInt(runState); WritableUtils.writeEnum(out, this.state); out.writeLong(startTime); out.writeLong(finishTime); Text.writeString(out, user); // Text.writeString(out, schedulingInfo); out.writeLong(superstepCount); out.writeBoolean(recovery); }
From source file:com.chinamobile.bcbsp.util.StaffStatus.java
License:Apache License
/** serialize * write this object to out./* w w w .j a v a 2s . c o m*/ * * @param out Writes to the output stream. */ @Override public void write(DataOutput out) throws IOException { jobId.write(out); staffId.write(out); out.writeInt(progress); WritableUtils.writeEnum(out, runState); Text.writeString(out, stateString); WritableUtils.writeEnum(out, phase); out.writeLong(startTime); out.writeLong(finishTime); out.writeLong(superstepCount); if (this.faultFlag == 0) { out.writeInt(this.faultFlag); } else { out.writeInt(this.faultFlag); this.fault.write(out); } out.writeBoolean(recovery); out.writeLong(this.currentSSTime); Text.writeString(out, workerManager); }
From source file:com.cloudera.sa.giraph.examples.ktrusses.PhaseWritable.java
License:Apache License
public void write(DataOutput out) throws IOException { out.writeBoolean(phase == null);/*from w w w. ja v a 2s . c om*/ if (phase != null) { WritableUtils.writeEnum(out, phase); } }
From source file:com.facebook.hiveio.common.Writables.java
License:Apache License
/** * Write an array of enums/*w w w . jav a 2 s. c om*/ * * @param enums Enum array * @param out DataOutput * @param <E> type of enum * @throws IOException */ public static <E extends Enum<E>> void writeEnumArray(DataOutput out, Enum<E>[] enums) throws IOException { out.writeInt(enums.length); if (enums.length > 0) { WritableUtils.writeString(out, enums[0].getDeclaringClass().getName()); } for (Enum<E> val : enums) { WritableUtils.writeEnum(out, val); } }
From source file:com.marklogic.mapreduce.StreamLocator.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { Text.writeString(out, path.toString()); WritableUtils.writeEnum(out, codec); }
From source file:com.moz.fiji.hive.io.EntityIdWritable.java
License:Apache License
@Override public void write(DataOutput out) throws IOException { WritableUtils.writeCompressedByteArray(out, mHBaseRowKey); // Write the components WritableUtils.writeVInt(out, mComponents.size()); for (Object component : mComponents) { if (component instanceof String) { WritableUtils.writeEnum(out, Component.STRING); String stringComponent = (String) component; WritableUtils.writeString(out, stringComponent); } else if (component instanceof Integer) { WritableUtils.writeEnum(out, Component.INTEGER); Integer intComponent = (Integer) component; WritableUtils.writeVInt(out, intComponent); } else if (component instanceof Long) { WritableUtils.writeEnum(out, Component.LONG); Long longComponent = (Long) component; WritableUtils.writeVLong(out, longComponent); } else if (component instanceof byte[]) { Preconditions.checkState(mComponents.size() == 1, "byte[] only valid as sole component."); WritableUtils.writeEnum(out, Component.RAW_HBASE_KEY); byte[] byteArrayComponent = (byte[]) component; WritableUtils.writeCompressedByteArray(out, byteArrayComponent); } else if (component == null) { WritableUtils.writeEnum(out, Component.NULL); } else {//from w w w . jav a 2s .co m throw new EntityIdException("Unexpected type for Component " + component.getClass().getName()); } } WritableUtils.writeString(out, mShellString); }