Exemple #1
0
 public SocketQueueRemoteRecordReceiver(NaiadDataStreamProtocol <T> recipient)
 {
     this.socketQueue   = new BlockingCollection <Socket>();
     this.recipient     = recipient;
     this.receiveThread = new Thread(this.IngressThread);
     this.receiveThread.Start();
 }
Exemple #2
0
 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(); });
 }
Exemple #3
0
 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);
     }
 }