public SocketQueueRemoteRecordReceiver(NaiadDataStreamProtocol <T> recipient) { this.socketQueue = new BlockingCollection <Socket>(); this.recipient = recipient; this.receiveThread = new Thread(this.IngressThread); this.receiveThread.Start(); }
public static void ToReceiver <R>(this Collection <R, Epoch> collection, NaiadDataStreamProtocol <Weighted <R> > receiver) where R : IEquatable <R> { collection.Subscribe(xs => { receiver.StartEpoch(); foreach (Weighted <R> x in xs) { receiver.Send(x); } receiver.EndEpoch(); }); }
public void Add(NaiadDataStreamProtocol <Weighted <R> > sender) { lock (this) // Mutually exclusive with the execution of an epoch. { sender.StartEpoch(); foreach (KeyValuePair <R, long> kvp in this.totalAccumulation) { sender.Send(new Weighted <R>(kvp.Key, kvp.Value)); } sender.EndEpoch(); this.senders.Add(sender); } }