@Override public void readFields(DataInput input) throws IOException { super.readFields(input); int size = input.readInt(); vertexMap = new MapMaker().concurrencyLevel( getConf().getNettyServerExecutionConcurrency()).initialCapacity( size).makeMap(); representativeVertex = getConf().createVertex(); representativeVertex.initialize( getConf().createVertexId(), getConf().createVertexValue(), getConf().createOutEdges()); useUnsafeSerialization = getConf().useUnsafeSerialization(); for (int i = 0; i < size; ++i) { progress(); I vertexId = getConf().createVertexId(); vertexId.readFields(input); int vertexDataSize = input.readInt(); byte[] vertexData = new byte[vertexDataSize]; input.readFully(vertexData); if (vertexMap.put(vertexId, vertexData) != null) { throw new IllegalStateException("readFields: Already saw vertex " + vertexId); } } }
@Override public void initialize(int partitionId, Progressable progressable) { super.initialize(partitionId, progressable); vertexMap = new MapMaker().concurrencyLevel( getConf().getNettyServerExecutionConcurrency()).makeMap(); representativeVertex = getConf().createVertex(); representativeVertex.initialize( getConf().createVertexId(), getConf().createVertexValue(), getConf().createOutEdges()); representativeCombinerVertex = getConf().createVertex(); representativeCombinerVertex.initialize( getConf().createVertexId(), getConf().createVertexValue(), getConf().createOutEdges()); useUnsafeSerialization = getConf().useUnsafeSerialization(); }