コード例 #1
0
 private void OnPaxosMessage(PaxosMessage msg)
 {
     foreach (var agent in agents)
     {
         agent.DispatchMessage(msg);
     }
 }
コード例 #2
0
        public void DispatchMessage(PaxosMessage result)
        {
            Action <object> value;

            if (registrations.TryGetValue(result.GetType(), out value) == false)
            {
                return;
            }
            value(result);
        }
コード例 #3
0
        protected Task SendAsync(Uri destination, PaxosMessage msg)
        {
            var channel = presence.GetNodeStateServiceAsync(destination);

            return(Task.Factory.FromAsync(channel.BeginReceivePaxosMessage, channel.EndReceivePaxosMessage, msg, null)
                   .ContinueWith(task =>
            {
                presence.CloseWcf(channel);
                if (task.Exception == null)
                {
                    return;
                }
                // we accept the possibility of failure.
                presence.Log("Could not communicate with {0}, because: {1}", new object[] { destination, task.Exception });
            }));
        }
 public void ReceivePaxosMessage(PaxosMessage message)
 {
     onPaxosMessage(message);
 }