public static AppAction CreateAppPoolChangedAction(string appPoolId)
        {
            AppAction action = new AppAction(AppActionType.SettingsChanged);

            action.appPoolId = appPoolId;
            return(action);
        }
        public static AppAction CreateBindingsChangedAction(string[] bindings)
        {
            AppAction action = new AppAction(AppActionType.SettingsChanged);

            action.bindings = bindings;
            return(action);
        }
Ejemplo n.º 3
0
Archivo: App.cs Proyecto: JianwenSun/cc
        internal void SetPendingAction(AppAction action)
        {
            if (action != null)
            {
                Fx.Assert(this.pendingAction == null, "There is already a pending action.");
            }

            this.pendingAction = action;
        }
Ejemplo n.º 4
0
        internal void SetPendingAction(AppAction action)
        {
            if (action != null)
            {
                Fx.Assert(this.pendingAction == null, "There is already a pending action.");
            }

            this.pendingAction = action;
        }
Ejemplo n.º 5
0
        protected override void OnApplicationBindingsChanged(string appKey, IntPtr bindingsMultiSz, int numberOfBindings)
        {
            Debug.Print("ListenerAdapter[" + ProtocolName + "]::OnApplicationBindingsChanged(" + appKey + ")");
            string[] bindings = null;
            try
            {
                bindings = base.ParseBindings(bindingsMultiSz, numberOfBindings);
            }
            catch (ArgumentException exception)
            {
                DiagnosticUtility.TraceHandledException(exception, TraceEventType.Error);

                // Ignore the binding change if WAS provides wrong bindings.
                return;
            }

            App app = null;

            lock (appManager)
            {
                // The app might have been removed due to the service shutdown.
                if (!appManager.Apps.TryGetValue(appKey, out app))
                {
                    return;
                }
            }

            try
            {
                if (app.PendingAction != null)
                {
                    app.PendingAction.MergeFromBindingChangedAction(bindings);
                }
                else
                {
                    if (app.MessageQueue.HasStartedQueueInstances)
                    {
                        app.SetPendingAction(AppAction.CreateBindingsChangedAction(bindings));
                        ScheduleClosingListenerChannelInstances(app);
                    }
                    else
                    {
                        RegisterNewBindings(app, bindings);
                    }
                }
            }
            catch (Exception exception)
            {
                HandleUnknownError(exception);
            }
        }
Ejemplo n.º 6
0
        protected override void OnApplicationDeleted(string appKey)
        {
            Debug.Print("ListenerAdapter[" + ProtocolName + "]::OnApplicationDeleted(" + appKey + ")");

            try
            {
                App app = null;
                lock (appManager)
                {
                    // CSDMain 190118
                    // In some cases WAS will send us duplicated notification for the deletion of a same appKey
                    if (!appManager.Apps.ContainsKey(appKey))
                    {
                        return;
                    }
                    app = appManager.Apps[appKey];
                }

                if (app.PendingAction != null)
                {
                    app.PendingAction.MergeFromDeletedAction();
                }
                else
                {
                    if (app.MessageQueue.HasStartedQueueInstances)
                    {
                        // Creae a new action
                        app.SetPendingAction(AppAction.CreateDeletedAction());
                        ScheduleClosingListenerChannelInstances(app);
                    }
                    else
                    {
                        CompleteDeleteApp(app);
                    }
                }
            }
            catch (Exception exception)
            {
                HandleUnknownError(exception);
            }
        }
Ejemplo n.º 7
0
        protected override void OnApplicationAppPoolChanged(string appKey, string appPoolId)
        {
            Debug.Print("ListenerAdapter[" + ProtocolName + "]::OnApplicationAppPoolChanged(" + appKey + ", " + appPoolId + ")");

            try
            {
                App app = null;
                lock (appManager)
                {
                    // The app might have been removed due to the service shutdown.
                    if (!appManager.Apps.TryGetValue(appKey, out app))
                    {
                        return;
                    }
                }

                if (app.PendingAction != null)
                {
                    app.PendingAction.MergeFromAppPoolChangedAction(appPoolId);
                }
                else
                {
                    if (app.MessageQueue.HasStartedQueueInstances)
                    {
                        // Create a new action
                        app.SetPendingAction(AppAction.CreateAppPoolChangedAction(appPoolId));
                        ScheduleClosingListenerChannelInstances(app);
                    }
                    else
                    {
                        CompleteAppPoolChange(app, appPoolId);
                    }
                }
            }
            catch (Exception exception)
            {
                HandleUnknownError(exception);
            }
        }
Ejemplo n.º 8
0
        bool Cleanup(bool closeInstances)
        {
            Debug.Print("ListenerAdapter[" + ProtocolName + "]::Cleanup()");
            canDispatch = false;
            bool completeSelf = true;

            if (closeInstances)
            {
                List <App> existingApps    = new List <App>();
                List <App> removeApps      = new List <App>();
                List <App> delayRemoveApps = new List <App>();
                lock (appManager)
                {
                    if (appManager.AppsCount != 0)
                    {
                        // cleanup for activation service stop: tell WAS about it
                        existingApps.AddRange(appManager.Apps.Values);
                        foreach (App app in existingApps)
                        {
                            if (app.MessageQueue.HasStartedQueueInstances)
                            {
                                delayRemoveApps.Add(app);
                            }
                            else
                            {
                                removeApps.Add(app);
                            }
                        }

                        existingApps.Clear();
                    }
                }

                if (removeApps.Count != 0)
                {
                    foreach (App app in removeApps)
                    {
                        RemoveApp(app);
                    }
                }

                if (delayRemoveApps.Count != 0)
                {
                    foreach (App app in delayRemoveApps)
                    {
                        if (app.PendingAction != null)
                        {
                            app.PendingAction.MergeFromDeletedAction();
                        }
                        else
                        {
                            // Create a new action
                            app.SetPendingAction(AppAction.CreateDeletedAction());
                            CloseAllListenerChannelInstances(app);
                        }
                    }

                    completeSelf = false;
                }
            }
            else
            {
                lock (appManager)
                {
                    appManager.Clear();
                }
            }

            return(completeSelf);
        }
Ejemplo n.º 9
0
 public static AppAction CreateAppPoolChangedAction(string appPoolId)
 {
     AppAction action = new AppAction(AppActionType.SettingsChanged);
     action.appPoolId = appPoolId;
     return action;
 }
Ejemplo n.º 10
0
 public static AppAction CreateBindingsChangedAction(string[] bindings)
 {
     AppAction action = new AppAction(AppActionType.SettingsChanged);
     action.bindings = bindings;
     return action;
 }