internal virtual void  sendLeaveMessage(Address coord, Address mbr)
        {
            Message msg = new Message(coord, null, null);
            GmsHDR  hdr = new GmsHDR(GmsHDR.LEAVE_REQ, mbr);

            msg.putHeader(HeaderType.GMS, hdr);
            gms.passDown(new Event(Event.MSG, msg));
        }
Beispiel #2
0
        public virtual void handleIsClusterInStateTransfer(Address sender)
        {
            Message msg = new Message(sender, null, new byte[0]);
            GmsHDR  hdr = new GmsHDR(GmsHDR.IS_NODE_IN_STATE_TRANSFER_RSP);

            gms.Stack.NCacheLog.Debug("gmsImpl.handleIsClusterInStateTransfer", "(state transfer request) sender: " + sender + " ->" + isInStateTransfer);
            hdr.arg = isInStateTransfer;
            msg.putHeader(HeaderType.GMS, hdr);
            gms.passDown(new Event(Event.MSG, msg, Priority.High));
        }
        internal virtual void sendJoinMessage(Address coord, Address mbr, string subGroup_name)
        {
            Message msg;
            GmsHDR  hdr;

            msg       = new Message(coord, null, null);
            hdr       = new GmsHDR(GmsHDR.JOIN_REQ, mbr, subGroup_name);
            hdr.GMSId = gms.unique_id;
            msg.putHeader(HeaderType.GMS, hdr);
            gms.passDown(new Event(Event.MSG_URGENT, msg, Priority.High));
        }
Beispiel #4
0
        internal virtual void sendSpeicalJoinMessage(Address mbr, ArrayList dests)
        {
            Message msg;
            GmsHDR  hdr;

            msg       = new Message(null, null, new byte[0]);
            msg.Dests = dests;
            hdr       = new GmsHDR(GmsHDR.SPECIAL_JOIN_REQUEST, mbr);
            hdr.GMSId = gms.unique_id;
            msg.putHeader(HeaderType.GMS, hdr);
            gms.passDown(new Event(Event.MSG_URGENT, msg, Priority.High));
        }
        private void sendMemberLeftNotificationToCoordinator(Address suspected, Address coordinator)
        {
            if (gms.Stack.NCacheLog.IsInfoEnabled)
            {
                gms.Stack.NCacheLog.Info("ParticipantGmsImp.sendMemberLeftNotification", "informing coordinator about abnormal connection breakage with " + suspected);
            }

            GmsHDR  hdr         = new GmsHDR(GmsHDR.CONNECTION_BROKEN, suspected);
            Message nodeLeftMsg = new Message(coordinator, null, new byte[0]);

            nodeLeftMsg.putHeader(HeaderType.GMS, hdr);
            gms.passDown(new Event(Event.MSG, nodeLeftMsg, Priority.High));
        }
 /// <summary>
 /// Informs the coodinator about the nodes to which this node can not establish connection
 /// on receiving the first view.Only the node who has most recently joined the cluster
 /// should inform the coodinator other nodes will neglect this event.
 /// </summary>
 /// <param name="nodes"></param>
 public override void handleConnectionFailure(System.Collections.ArrayList nodes)
 {
     if (nodes != null && nodes.Count > 0)
     {
         if (gms.Stack.NCacheLog.IsInfoEnabled)
         {
             gms.Stack.NCacheLog.Info("ParticipantGmsImp.handleConnectionFailure", "informing coordinator about connection failure with [" + Global.CollectionToString(nodes) + "]");
         }
         GmsHDR header = new GmsHDR(GmsHDR.CAN_NOT_CONNECT_TO);
         header.nodeList = nodes;
         Message msg = new Message(gms.determineCoordinator(), null, new byte[0]);
         msg.putHeader(HeaderType.GMS, header);
         gms.passDown(new Event(Event.MSG, msg, Priority.High));
     }
 }
        public override void handleNodeRejoining(Address node)
        {
            if (node != null)
            {
                if (gms.Stack.NCacheLog.IsInfoEnabled)
                {
                    gms.Stack.NCacheLog.Info("ParticipantGmsImpl.handleNodeRejoining", "I should inform coordinator about node rejoining with " + node);
                }

                if (gms.members.contains(node))
                {
                    //inform coordinator about the node rejoining in the cluster.
                    GmsHDR  header       = new GmsHDR(GmsHDR.INFORM_NODE_REJOINING, node);
                    Message rejoiningMsg = new Message(gms.determineCoordinator(), null, new byte[0]);
                    rejoiningMsg.putHeader(HeaderType.GMS, header);
                    gms.passDown(new Event(Event.MSG, rejoiningMsg, Priority.High));
                }
            }
        }
        public override void handleConnectedNodesRequest(Address src, int reqId)
        {
            if (gms.determineCoordinator().Equals(src))
            {
                ArrayList mbrs      = gms.members.Members;
                ArrayList suspected = suspected_mbrs.Clone() as ArrayList;

                foreach (Address suspect in suspected_mbrs)
                {
                    mbrs.Remove(suspect);
                }

                if (gms.Stack.NCacheLog.IsInfoEnabled)
                {
                    gms.Stack.NCacheLog.Info("ParticipantGmsImp.handleConnectedNodesRequest    " + gms.local_addr + " --> " + Global.ArrayListToString(mbrs));
                }

                Message rspMsg = new Message(src, null, new byte[0]);
                GmsHDR  hdr    = new GmsHDR(GmsHDR.CONNECTED_NODES_RESPONSE, (Object)reqId);
                hdr.nodeList = mbrs;
                rspMsg.putHeader(HeaderType.GMS, hdr);
                gms.passDown(new Event(Event.MSG, rspMsg, Priority.High));
            }
        }