No operation, no effect.
Inheritance: SimpleInstruction
コード例 #1
0
 public void VisitNoOperation(NoOperation node)
 {
 }
コード例 #2
0
 /// <summary>
 /// update backups' list
 /// </summary>
 /// <param name="msg"></param>
 public void UpdateBackups(NoOperation msg)
 {
     backups = msg.BackupServersInfo;
 }
コード例 #3
0
 protected virtual void ProcessNoOperationMessage(NoOperation message,
                                                  IDictionary <int, ProblemDataSet> dataSets,
                                                  IDictionary <int, ActiveComponent> activeComponents)
 {
 }
コード例 #4
0
 protected virtual Message[] RespondNoOperationMessage(NoOperation message,
                                                       IDictionary <int, ProblemDataSet> dataSets,
                                                       IDictionary <int, ActiveComponent> activeComponents)
 {
     return(null);
 }
コード例 #5
0
        protected override Message[] RespondStatusMessage(Status message,
                                                          IDictionary <int, ProblemDataSet> dataSets,
                                                          IDictionary <int, ActiveComponent> activeComponents, List <BackupServerInfo> backups)
        {
            //if sent by TM - send NoOp + return from CaseExtractor.GetMessageForTaskManager
            //if sent by CN - send NoOp + return from CaseExtractor.GetMessageForCompNode
            var who = (int)message.Id;

            if (!activeComponents.ContainsKey(who))
            {
                return new Message[] { new Error()
                                       {
                                           ErrorMessage = "who are you?",
                                           ErrorType    = ErrorErrorType.UnknownSender
                                       } }
            }
            ;

            activeComponents[who].StatusWatch.Restart();

            Message whatToDo = null;

            Log.DebugFormat("Handling status message of {0}(id={1}). Searching for problems.",
                            activeComponents[who].ComponentType, who);
            switch (activeComponents[who].ComponentType)
            {
            case ComponentType.ComputationalNode:
                whatToDo = DataSetOps.GetMessageForCompNode(activeComponents, who, dataSets);

                break;

            case ComponentType.TaskManager:
                whatToDo = DataSetOps.GetMessageForTaskManager(activeComponents, who, dataSets);
                break;

            case ComponentType.CommunicationServer:
                var msgs = SynchronizationQueue.ToList();
                SynchronizationQueue = new ConcurrentQueue <Message>();
                msgs.Add(new NoOperation()
                {
                    BackupServersInfo = backups.ToArray()
                });
                return(msgs.ToArray());
            }

            var noop = new NoOperation()
            {
                BackupServersInfo = backups.ToArray()
            };

            if (whatToDo == null)
            {
                Log.DebugFormat("Nothing additional found for {0} (id={1})",
                                activeComponents[who].ComponentType, who);
                return(new Message[]
                {
                    noop
                });
            }
            Log.DebugFormat("Found problem ({0}) for {1} (id={2})",
                            whatToDo.MessageType, activeComponents[who].ComponentType, who);

            SynchronizationQueue.Enqueue(whatToDo);
            return(new[]
            {
                whatToDo,
                noop
            });
        }