private void AnnounceStartup(int barrierId) { int seqno = this.GetSequenceNumber(-1); SendBufferPage startupPage = SendBufferPage.CreateSpecialPage(MessageHeader.GenerateBarrierMessageHeader(barrierId), seqno, this.HeaderSerializer); BufferSegment startupSegment = startupPage.Consume(); for (int i = 0; i < this.connections.Count - 2; ++i) startupSegment.Copy(); for (int i = 0; i < this.connections.Count; ++i) { if (i != this.localProcessID) { Logging.Info("Sending startup message to process {0}", i); this.SendBufferSegment(startupPage.CurrentMessageHeader, i, startupSegment); } } }
public void AnnounceCheckpoint() { int seqno = this.GetSequenceNumber(-1); SendBufferPage checkpointPage = SendBufferPage.CreateSpecialPage(MessageHeader.Checkpoint, seqno, this.Controller.SerializationFormat.GetSerializer<MessageHeader>()); BufferSegment checkpointSegment = checkpointPage.Consume(); for (int i = 0; i < this.connections.Count - 2; ++i) checkpointSegment.Copy(); for (int i = 0; i < this.connections.Count; ++i) { if (i != this.localProcessID) { Logging.Info("Sending checkpoint message to process {0}", i); this.SendBufferSegment(checkpointPage.CurrentMessageHeader, i, checkpointSegment); } } }
private void AnnounceShutdown() { Logging.Progress("Announcing shutdown"); int seqno = this.GetSequenceNumber(-1); SendBufferPage shutdownPage = SendBufferPage.CreateShutdownMessagePage(seqno, this.HeaderSerializer); BufferSegment shutdownSegment = shutdownPage.Consume(); for (int i = 0; i < this.connections.Count - 2; ++i) shutdownSegment.Copy(); for (int i = 0; i < this.connections.Count; ++i) { if (i != this.localProcessID) { Logging.Progress("Sending shutdown message to process {0}", i); this.SendBufferSegment(shutdownPage.CurrentMessageHeader, i, shutdownSegment); } } }
private void SendPageContents(MessageHeader hdr, BufferSegment segment) { if (segment.Length > 0) { if (debug) { Console.Error.WriteLine(" Sending page len {0}", segment.Length); } segment.Copy(); // Increment refcount for the destination process. this.bytesSent += segment.Length; this.messagesSent += 1; this.sender.Vertex.scheduler.statistics[(int)RuntimeStatistic.TxProgressMessages] += 1; this.sender.Vertex.scheduler.statistics[(int)RuntimeStatistic.TxProgressBytes] += segment.Length; this.networkChannel.SendBufferSegment(hdr, this.receiverProcessId, segment, true); } // Decrement refcount for the initial call to Consume(). segment.Dispose(); }
public int SendBufferSegment(MessageHeader hdr, BufferSegment segment) { segment.Copy(); this.networkChannel.SendBufferSegment(hdr, this.destProcessID, segment, true); return(this.nextPageIndex++); }