Ejemplo n.º 1
0
        private void Subscribe(String repl_url)
        {
            Replica repl    = null;
            Boolean success = false;

            while (!success)
            {
                try{
                    repl       = (Replica)Activator.GetObject(typeof(Replica), repl_url);
                    repl.Send += new Replica.SendHandler(this.Receive);
                    success    = true;
                } catch (Exception) {
                    Console.WriteLine("Retrying connect to " + repl_url);
                }
                Thread.Sleep(1000);
            }
        }
 public void Receive(Replica repl, EventArgs e)
 {
     new Thread(() => {
         Tuple tuple = (Tuple)e;
         if (!semantics.Contains("at-least-once"))
         {
             foreach (Tuple t in sent_tuples.Values)
             {
                 if (t.father != null)
                 {
                     if (t.father.id.Equals(tuple.id))
                     {
                         return;
                     }
                 }
             }
         }
         input_queue.Enqueue(tuple);
     }).Start();
 }
Ejemplo n.º 3
0
 private void Receive(Replica repl, EventArgs e)
 {
     queue.Enqueue((Tuple)e);
 }