Exemplo n.º 1
0
        protected override bool handleSpecialDownEvent(Event evt)
        {
            //We handle the view message differently to handle the situation
            //where coordinator itself is leaving 
            if (evt.Type == Event.VIEW_BCAST_MSG)
            {
                Stack.NCacheLog.Error("TCP.handleSpecialDownEvent", evt.ToString());
                down(new Event(Event.MSG, evt.Arg, evt.Priority));
                Stack.NCacheLog.Error("TCP.handleSpecialDownEvent", "view broadcast is complete");
                return false;
            }

            return base.handleSpecialDownEvent(evt);
        }
Exemplo n.º 2
0
		/// <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
		}