Esempio n. 1
0
        protected override void OnApplicationPoolAllQueueInstancesStopped(string appPoolId, int queueId)
        {
            Debug.Print("ListenerAdapter[" + ProtocolName + "]::OnApplicationPoolAllQueueInstancesStopped(" + appPoolId + ", " + queueId + ")");

            if (!isOpen)
            {
                if (closingProcessStatus != ClosingProcessBlocked)
                {
                    // OnConfigManagerDisconnected was already called. We should just return.
                    return;
                }
            }

            try
            {
                AppPool appPool = null;
                lock (appManager)
                {
                    if (!appManager.AppPools.TryGetValue(appPoolId, out appPool))
                    {
                        // Ignore this notification if we received OnApplicationPoolDeleted.
                        return;
                    }
                }

                IActivatedMessageQueue queue = activationService.FindQueue(queueId);
                if (queue == null)
                {
                    // This is the belated notification. Ignore it.
                    return;
                }

                Fx.Assert(queue.App.AppPool.AppPoolId == appPoolId, "OnApplicationPoolAllQueueInstancesStopped: unexpected pool id");
                queue.OnQueueInstancesStopped();

                App app = queue.App;

                try
                {
                    if (app.PendingAction.ActionType == AppActionType.Deleted)
                    {
                        CompleteDeleteApp(app);
                        SignalCleanupForNoApps();
                    }
                    else if (app.PendingAction.ActionType == AppActionType.SettingsChanged)
                    {
                        CompleteAppSettingsChanged(app);
                    }
                }
                finally
                {
                    // Reset the action
                    app.SetPendingAction(null);
                }
            }
            catch (Exception exception)
            {
                HandleUnknownError(exception);
            }
        }