public void SerializedMessageReceived(SerializedMessage serializedMessage, ReturnAddress from) { System.Diagnostics.Debug.Assert(this.AvailableEntrancy >= -1); if (this.decoder == null) { this.decoder = new AutoSerializedMessageDecoder <S, T>(this.Vertex.SerializationFormat); } if (this.loggingEnabled) { this.LogMessage(serializedMessage); } Message <S, T> msg = new Message <S, T>(); msg.Allocate(AllocationReason.Deserializer); // N.B. At present, AsTypedMessages reuses and yields the same given msg for each batch // of deserialized messages. As a result, the message passed to OnReceive MUST NOT // be queued, because its payload will be overwritten by the next batch of messages. foreach (Message <S, T> message in this.decoder.AsTypedMessages(serializedMessage, msg)) { this.OnReceive(message, from); } msg.Release(AllocationReason.Deserializer); }
public override void OnReceive(Message <S, T> message, ReturnAddress from) { if (this.LoggingEnabled) { this.LogMessage(message); } this.MessageCallback(message, from); }
/// <summary> /// Buffers the content of the given <paramref name="serializedMessage"/>, and /// schedules a corresponding notification on the owning <see cref="Vertex"/>. /// </summary> /// <param name="serializedMessage">The serialized message.</param> /// <param name="sender">The sender of the message.</param> public void SerializedMessageReceived(SerializedMessage serializedMessage, ReturnAddress sender) { System.Diagnostics.Debug.Assert(this.AvailableEntrancy >= -1); if (this.decoder == null) { this.decoder = new AutoSerializedMessageDecoder <TRecord, TTime>(this.Vertex.SerializationFormat); } foreach (Message <TRecord, TTime> message in this.decoder.AsTypedMessages(serializedMessage)) { this.OnReceive(message, sender); message.Release(); } }
/// <summary> /// Buffers the content of the given <paramref name="message"/>, and schedules /// a corresponding notification on the owning <see cref="Vertex"/>. /// </summary> /// <param name="message">The message.</param> /// <param name="sender">The sender of the message.</param> public void OnReceive(Message <TRecord, TTime> message, ReturnAddress sender) { if (!this.recordsToProcess.ContainsKey(message.time)) { this.recordsToProcess.Add(message.time, new SpinedList <TRecord>()); this.vertex.NotifyAt(message.time); } var list = this.recordsToProcess[message.time]; for (int i = 0; i < message.length; ++i) { list.Add(message.payload[i]); } }
public void SerializedMessageReceived(SerializedMessage serializedMessage, ReturnAddress from) { System.Diagnostics.Debug.Assert(this.AvailableEntrancy >= -1); if (this.decoder == null) { this.decoder = new AutoSerializedMessageDecoder <S, T>(this.Vertex.SerializationFormat); } if (this.loggingEnabled) { this.LogMessage(serializedMessage); } foreach (Message <S, T> message in this.decoder.AsTypedMessages(serializedMessage)) { this.OnReceive(message, from); message.Release(); } }
public abstract void OnReceive(Message <S, T> message, ReturnAddress from);