internal virtual void sendLeaveMessage(Address coord, Address mbr) { Message msg = new Message(coord, null, null); GMS.HDR hdr = new GMS.HDR(GMS.HDR.LEAVE_REQ, mbr); msg.putHeader(HeaderType.GMS, hdr); gms.passDown(new Event(Event.MSG, msg)); }
public virtual void handleIsClusterInStateTransfer(Address sender) { Message msg = new Message(sender, null, new byte[0]); GMS.HDR hdr = new GMS.HDR(GMS.HDR.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, Alachisoft.NCache.Common.Enum.Priority.Critical)); }
/* --------------------------- Private Methods ------------------------------------ */ internal virtual void sendJoinMessage(Address coord, Address mbr, string subGroup_name, bool isStartedAsMirror) { Message msg; GMS.HDR hdr; msg = new Message(coord, null, null); hdr = new GMS.HDR(GMS.HDR.JOIN_REQ, mbr, subGroup_name, isStartedAsMirror); hdr.GMSId = gms.unique_id; msg.putHeader(HeaderType.GMS, hdr); gms.passDown(new Event(Event.MSG_URGENT, msg, Priority.Critical)); }
internal virtual void sendSpeicalJoinMessage(Address mbr, ArrayList dests) { Message msg; GMS.HDR hdr; msg = new Message(null, null, new byte[0]); msg.Dests = dests; hdr = new GMS.HDR(GMS.HDR.SPECIAL_JOIN_REQUEST, mbr); hdr.GMSId = gms.unique_id; msg.putHeader(HeaderType.GMS, hdr); gms.passDown(new Event(Event.MSG_URGENT, msg, Priority.Critical)); }
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); } GMS.HDR hdr = new GMS.HDR(GMS.HDR.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.Critical)); }
/// <summary>Queues or passes up events. No queue sync. necessary, as this method is never called /// concurrently. /// </summary> public override void up(Event evt) { switch (evt.Type) { case Event.MSG: Message msg = (Message)evt.Arg; object obj = msg.getHeader(HeaderType.GMS); if (obj != null && obj is GMS.HDR) { GMS.HDR hdr = (GMS.HDR)obj; if (hdr.type == GMS.HDR.VIEW || hdr.type == GMS.HDR.JOIN_RSP) { queingLock.AcquireWriterLock(Timeout.Infinite); try { if (Stack.NCacheLog.IsInfoEnabled) { Stack.NCacheLog.Info("Queue.Up()", "Received VIEW event, so we start up_queuing"); } queueing_up = true; // starts up queuing } finally { queingLock.ReleaseWriterLock(); } } if (Stack.NCacheLog.IsInfoEnabled) { Stack.NCacheLog.Info("Queue.up()", "Message Headers = " + Global.CollectionToString(msg.Headers)); } passUp(evt); return; } queingLock.AcquireReaderLock(Timeout.Infinite); try { if (queueing_up) { if (Stack.NCacheLog.IsInfoEnabled) { Stack.NCacheLog.Info("queued up event " + evt.ToString()); } up_vec.Add(evt); return; } } finally { queingLock.ReleaseReaderLock(); } break; } passUp(evt); // Pass up to the layer above us }
/// <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("ClientGmsImp.handleConnectionFailure", "informing coordinator about connection failure with [" + Global.CollectionToString(nodes) + "]"); } GMS.HDR header = new GMS.HDR(GMS.HDR.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.Critical)); } }
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. GMS.HDR header = new GMS.HDR(GMS.HDR.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.Critical)); } } }
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]); GMS.HDR hdr = new GMS.HDR(GMS.HDR.CONNECTED_NODES_RESPONSE, (Object)reqId); hdr.nodeList = mbrs; rspMsg.putHeader(HeaderType.GMS, hdr); gms.passDown(new Event(Event.MSG, rspMsg, Priority.Critical)); } }