コード例 #1
0
        public override bool Equals(object o)
        {
            if (this == o)
            {
                return(true);
            }
            if (o == null || this.GetType() != o.GetType())
            {
                return(false);
            }

            MemberIsAvailable that = ( MemberIsAvailable )o;

            if (!_clusterUri.Equals(that._clusterUri))
            {
                return(false);
            }
            if (!_instanceId.Equals(that._instanceId))
            {
                return(false);
            }
            if (!_role.Equals(that._role))
            {
                return(false);
            }
            return(_roleUri.Equals(that._roleUri));
        }
コード例 #2
0
            public override void Receive(Payload payload)
            {
                try
                {
                    object value = outerInstance.Serializer.receive(payload);
                    if (value is MemberIsAvailable)
                    {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final MemberIsAvailable memberIsAvailable = (MemberIsAvailable) value;
                        MemberIsAvailable memberIsAvailable = ( MemberIsAvailable )value;

                        // Update snapshot
                        outerInstance.clusterMembersSnapshot.AvailableMember(memberIsAvailable);

                        outerInstance.log.Info("Snapshot:" + outerInstance.clusterMembersSnapshot.CurrentAvailableMembers);

                        outerInstance.Listeners.notify(listener => listener.memberIsAvailable(memberIsAvailable.Role, memberIsAvailable.InstanceId, memberIsAvailable.RoleUri, memberIsAvailable.StoreId));
                    }
                    else if (value is MemberIsUnavailable)
                    {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final MemberIsUnavailable memberIsUnavailable = (MemberIsUnavailable) value;
                        MemberIsUnavailable memberIsUnavailable = ( MemberIsUnavailable )value;

                        // Update snapshot
                        outerInstance.clusterMembersSnapshot.UnavailableMember(memberIsUnavailable.ClusterUri, memberIsUnavailable.InstanceId, memberIsUnavailable.Role);

                        outerInstance.Listeners.notify(listener => listener.memberIsUnavailable(memberIsUnavailable.Role, memberIsUnavailable.InstanceId));
                    }
                }
                catch (Exception t)
                {
                    outerInstance.log.Error(string.Format("Could not handle cluster member available message: {0} ({1:D})", Base64.Encoder.encodeToString(payload.Buf), payload.Len), t);
                }
            }
コード例 #3
0
 public override void MemberIsAvailable(string role, URI roleUri, StoreId storeId)
 {
     try
     {
         MemberIsAvailable message = new MemberIsAvailable(role, _myId, _serverClusterId, roleUri, storeId);
         Payload           payload = Serializer.broadcast(message);
         _atomicBroadcast.broadcast(payload);
     }
     catch (Exception e)
     {
         _log.warn("Could not distribute member availability", e);
     }
 }
コード例 #4
0
 public virtual void AvailableMember(MemberIsAvailable memberIsAvailable)
 {
     AvailableMembers = asList(NextSnapshotFunction.apply(AvailableMembers, memberIsAvailable));
 }