コード例 #1
0
ファイル: ListenerAdapter.cs プロジェクト: dox0/DotNet471RS3
        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);
            }
        }
コード例 #2
0
ファイル: ListenerAdapter.cs プロジェクト: dox0/DotNet471RS3
        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);
            }
        }
コード例 #3
0
ファイル: ListenerAdapter.cs プロジェクト: dox0/DotNet471RS3
        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);
            }
        }
コード例 #4
0
ファイル: ListenerAdapter.cs プロジェクト: dox0/DotNet471RS3
        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);
            }
        }