@Override public void readFieldsRequest(DataInput input) throws IOException { partitionId = input.readInt(); // At this moment the Computation class have already been replaced with // the new one, and we deal with messages from previous superstep vertexIdMessageMap = new ByteArrayVertexIdMessages<>( getConf().<M>createIncomingMessageValueFactory()); vertexIdMessageMap.setConf(getConf()); vertexIdMessageMap.initialize(); vertexIdMessageMap.readFields(input); }
/** * Set whether message sizes should be encoded. This should only be a * possibility when not combining. When combining, all messages need to be * de-serialized right away, so this won't help. */ private void setUseMessageSizeEncoding() { if (!getConf().useOutgoingMessageCombiner()) { useMessageSizeEncoding = getConf().useMessageSizeEncoding(); } else { useMessageSizeEncoding = false; } }
@Override public int getSerializedSize() { return super.getSerializedSize() + 4 + vertexIdMessageMap.getSerializedSize(); } }
serverData.getCurrentMessageStore(); ByteArrayVertexIdMessages<I, Writable> vertexIdMessages = new ByteArrayVertexIdMessages<I, Writable>( configuration.createOutgoingMessageValueFactory()); vertexIdMessages.setConf(configuration); vertexIdMessages.initialize(); for (I vertexId : messageStore.getPartitionDestinationVertices(partitionId)) { vertexIdMessages.add(vertexId, message); if (vertexIdMessages.getSize() > maxMessagesSizePerWorker) { WritableRequest messagesRequest = new SendPartitionCurrentMessagesRequest<I, V, E, Writable>( doRequest(workerInfo, messagesRequest); vertexIdMessages = new ByteArrayVertexIdMessages<I, Writable>( configuration.createOutgoingMessageValueFactory()); vertexIdMessages.setConf(configuration); vertexIdMessages.initialize(); if (!vertexIdMessages.isEmpty()) { WritableRequest messagesRequest = new SendPartitionCurrentMessagesRequest<I, V, E, Writable>(
@Override public VertexIdMessages<I, M> createVertexIdData() { return new ByteArrayVertexIdMessages<I, M>( getConf().<M>createOutgoingMessageValueFactory()); }
@Override public void initialize() { super.initialize(); setUseMessageSizeEncoding(); }
.get(partitionId); if (idMsgs == null) { idMsgs = new ByteArrayVertexIdMessages<>( getConf().<M>createOutgoingMessageValueFactory()); idMsgs.setConf(getConf()); idMsgs.initialize(initialSize); partitionIdMsgs.put(partitionId, idMsgs); idMsgs.add(vertexId, msg); if (!idMsgs.getValue().isEmpty()) { serverData.getIncomingMessageStore().addPartitionMessages( idMsgs.getKey(), idMsgs.getValue());
@Override public VertexIdMessages<I, M> createVertexIdData() { return new ByteArrayVertexIdMessages<I, M>( getConf().createOutgoingMessageValueFactory()); }
@Override public void initialize(int expectedSize) { super.initialize(expectedSize); setUseMessageSizeEncoding(); }
@Override protected VertexIdMessages<I, M> readNextEntry(DataInput in) throws IOException { byte messageType = in.readByte(); SerializedMessageClass messageClass = SerializedMessageClass.values()[messageType]; VertexIdMessages<I, M> vim; switch (messageClass) { case BYTE_ARRAY_VERTEX_ID_MESSAGES: vim = new ByteArrayVertexIdMessages<>(messageValueFactory); vim.setConf(config); break; case BYTE_ARRAY_ONE_MESSAGE_TO_MANY_IDS: vim = new ByteArrayOneMessageToManyIds<>(messageValueFactory); vim.setConf(config); break; default: throw new IllegalStateException("readNextEntry: unsupported " + "serialized message type!"); } vim.readFields(in); return vim; }