Example usage for org.apache.hadoop.io WritableUtils writeCompressedStringArray

List of usage examples for org.apache.hadoop.io WritableUtils writeCompressedStringArray

Introduction

In this page you can find the example usage for org.apache.hadoop.io WritableUtils writeCompressedStringArray.

Prototype

public static void writeCompressedStringArray(DataOutput out, String[] s) throws IOException 

Source Link

Usage

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  ww  .  jav a2s.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/*from   w w w  . j a  v  a2 s.c om*/
 *        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.sync.SuperStepCommand.java

License:Apache License

@Override
public void write(DataOutput out) throws IOException {
    out.writeInt(this.commandType);
    Text.writeString(out, this.initWritePath);
    Text.writeString(out, this.initReadPath);
    out.writeInt(this.ableCheckPoint);
    out.writeInt(this.nextSuperStepNum);
    out.writeInt(this.oldCheckPoint);
    out.writeInt(this.aggValues.length);
    int count = this.aggValues.length;
    for (int i = 0; i < count; i++) {
        Text.writeString(out, this.aggValues[i]);
    }//  www .  ja va 2  s  .  c  o m
    if (partitionToWorkerManagerNameAndPort == null) {
        WritableUtils.writeVInt(out, 0);
    } else {
        WritableUtils.writeVInt(out, partitionToWorkerManagerNameAndPort.size());
        String[] partitionToWMName = null;
        for (Integer i : this.partitionToWorkerManagerNameAndPort.keySet()) {
            partitionToWMName[i] = partitionToWorkerManagerNameAndPort.get(i);
        }
        WritableUtils.writeCompressedStringArray(out, partitionToWMName);
    }
    out.writeUTF(this.migrateStaffIDs);
    this.migrateVertexCommand.write(out);
}

From source file:com.newland.bi.bigdata.hdfs.Configuration.java

License:Apache License

@Override
public void write(DataOutput out) throws IOException {
    Properties props = getProps();
    WritableUtils.writeVInt(out, props.size());
    for (Map.Entry<Object, Object> item : props.entrySet()) {
        org.apache.hadoop.io.Text.writeString(out, (String) item.getKey());
        org.apache.hadoop.io.Text.writeString(out, (String) item.getValue());
        WritableUtils.writeCompressedStringArray(out, updatingResource.get(item.getKey()));
    }/*from  w  ww  . ja  v  a 2s  .c  om*/
}