GetMember() публичный Метод

public GetMember ( Address address ) : IMember
address Hazelcast.IO.Address
Результат IMember
Пример #1
0
        private IList <MembershipEvent> DetectMembershipEvents(IDictionary <string, IMember> prevMembers)
        {
            IList <MembershipEvent> events = new List <MembershipEvent>();
            var eventMembers = GetMembers();

            foreach (var member in _members)
            {
                IMember former;
                prevMembers.TryGetValue(member.GetUuid(), out former);
                if (former == null)
                {
                    events.Add(new MembershipEvent(_client.GetCluster(), member, MembershipEvent.MemberAdded,
                                                   eventMembers));
                }
                else
                {
                    prevMembers.Remove(member.GetUuid());
                }
            }
            foreach (var member in prevMembers.Values)
            {
                events.Add(new MembershipEvent(_client.GetCluster(), member, MembershipEvent.MemberRemoved, eventMembers));
                var address = member.GetAddress();
                if (_clusterService.GetMember(address) == null)
                {
                    var connection = _connectionManager.GetConnection(address);
                    if (connection != null)
                    {
                        _connectionManager.DestroyConnection(connection);
                    }
                }
            }
            return(events);
        }
Пример #2
0
        private IList <MembershipEvent> DetectMembershipEvents(ISet <IMember> prevMembers)
        {
            var events = new List <MembershipEvent>();

            var eventMembers = ImmutableSetOfMembers();

            var newMembers = new LinkedList <IMember>();

            foreach (var member in _members)
            {
                if (!prevMembers.Remove(member))
                {
                    newMembers.AddLast(member);
                }
            }
            // removal events should be added before added events
            foreach (var member in  prevMembers)
            {
                events.Add(new MembershipEvent(_client.GetCluster(), member, MembershipEvent.MemberRemoved, eventMembers));
                var address = member.GetAddress();
                if (_clusterService.GetMember(address) == null)
                {
                    var connection = _connectionManager.GetConnection(address);
                    if (connection != null)
                    {
                        _connectionManager.DestroyConnection(connection, new TargetDisconnectedException(address, "member left the cluster."));
                    }
                }
            }
            foreach (var member in newMembers)
            {
                events.Add(new MembershipEvent(_client.GetCluster(), member, MembershipEvent.MemberAdded, eventMembers));
            }
            return(events);
        }