コード例 #1
0
 public void RestartApp(AppIdTuple appIdTuple)
 {
     impl.RestartApp(appIdTuple);
 }
コード例 #2
0
        void processIncomingMessage(Message msg)
        {
            Type t = msg.GetType();

            if (t != typeof(AppsStateMessage)) // do not log frequent messages
            {
                log.DebugFormat("Incoming Message {0}", msg.ToString());
            }

            if (t == typeof(AppsStateMessage))
            {
                var m = msg as AppsStateMessage;
                updateRemoteAppState(m.appsState);
            }
            else
            if (t == typeof(PlansStateMessage))
            {
                var m = msg as PlansStateMessage;
                updatePlansState(m.plansState);
            }
            else
            //if (t == typeof(SelectPlanMessage))
            //{
            //    var m = msg as SelectPlanMessage;
            //    localOps.SelectPlan(m.plan);
            //}
            //else
            if (t == typeof(LaunchAppMessage))
            {
                var m = msg as LaunchAppMessage;
                if (m.appIdTuple.MachineId == machineId)
                {
                    localOps.LaunchApp(m.appIdTuple);
                }
            }
            else
            if (t == typeof(KillAppMessage))
            {
                var m = msg as KillAppMessage;
                if (m.appIdTuple.MachineId == machineId)
                {
                    localOps.KillApp(m.appIdTuple);
                }
            }
            else
            if (t == typeof(RestartAppMessage))
            {
                var m = msg as RestartAppMessage;
                if (m.appIdTuple.MachineId == machineId)
                {
                    localOps.RestartApp(m.appIdTuple);
                }
            }
            else
            if (t == typeof(SetAppEnabledMessage))
            {
                var m = msg as SetAppEnabledMessage;
                localOps.SetAppEnabled(m.planName, m.appIdTuple, m.enabled);
            }
            else
            if (t == typeof(StartPlanMessage))
            {
                var m = msg as StartPlanMessage;
                localOps.StartPlan(m.planName);
            }
            else
            if (t == typeof(StopPlanMessage))
            {
                var m = msg as StopPlanMessage;
                localOps.StopPlan(m.planName);
            }
            else
            if (t == typeof(KillPlanMessage))
            {
                var m = msg as KillPlanMessage;
                localOps.KillPlan(m.planName);
            }
            else
            if (t == typeof(RestartPlanMessage))
            {
                var m = msg as RestartPlanMessage;
                localOps.RestartPlan(m.planName);
            }
            else
            if (t == typeof(CurrentPlanMessage))
            {
                var m = msg as CurrentPlanMessage;

                // if master's plan is same as ours, do not do anything, othewise load master's plan
                var localPlan = localOps.GetCurrentPlan();
                if (localPlan != null)
                {
                    if (localPlan.Name != m.planName)
                    {
                        localOps.SelectPlan(m.planName);
                    }
                }
            }
            else
            if (t == typeof(PlanRepoMessage))
            {
                var m = msg as PlanRepoMessage;
                localOps.SetPlanRepo(m.repo);
            }
            else
            if (t == typeof(RemoteOperationErrorMessage))
            {
                var m = msg as RemoteOperationErrorMessage;
                throw new RemoteOperationErrorException(m.Requestor, m.Message, m.Attributes);
            }
        }