Ejemplo n.º 1
0
        private void threadSpin()
        {
            var cmpName = string.Empty;

            while (Running)
            {
                try
                {
                    var now = LocalizedTime;

                    cmpName = ".Manager";
                    if ((now - m_LastManagerVisit).TotalMilliseconds >= MANAGER_VISIT_GRANULARITY_MS)
                    {
                        m_LastManagerVisit = now;

                        cmpName = ".Providers";
                        foreach (var component in Providers)
                        {
                            cmpName = component.Name;
                            run(() => component.AcceptManagerVisit(this, now), nameof(threadSpin), cmpName, rethrow: false);
                        }

                        cmpName = ".Bindings";
                        foreach (var component in Bindings)
                        {
                            cmpName = component.Name;
                            run(() => component.AcceptManagerVisit(this, now), nameof(threadSpin), cmpName, rethrow: false);
                        }

                        cmpName = m_ServerHandler.Name;
                        run(() => m_ServerHandler.AcceptManagerVisit(this, now), nameof(threadSpin), cmpName, rethrow: false);

                        cmpName = nameof(purgeTimedOutCallSlots);
                        run(() => purgeTimedOutCallSlots(now), nameof(threadSpin), cmpName, rethrow: false);//calls
                    }//at manager visit granularity

                    cmpName = nameof(purgeTimedOutCallSlotsWithTasks);
                    run(() => purgeTimedOutCallSlotsWithTasks(now), nameof(threadSpin), cmpName, rethrow: false);//callsWithTasks

                    cmpName = string.Empty;

                    m_Waiter.WaitOne(THREAD_GRANULARITY_MS);
                }
                catch (Exception error)
                {
                    WriteLog(MessageType.CatastrophicError,
                             nameof(threadSpin),
                             "GlueService.threadSpin(component: '{0}') leaked: {1}".Args(cmpName, error.ToMessageWithType()),
                             error);
                }
            }//while(Running)
        }
Ejemplo n.º 2
0
        private void threadSpin()
        {
            var cmpName = string.Empty;

            while (Running)
            {
                try
                {
                    var now = LocalizedTime;

                    cmpName = ".Providers";
                    foreach (var component in Providers)
                    {
                        cmpName = component.Name;
                        component.AcceptManagerVisit(this, now);
                    }

                    cmpName = ".Bindings";
                    foreach (var component in Bindings)
                    {
                        cmpName = component.Name;
                        component.AcceptManagerVisit(this, now);
                    }

                    cmpName = m_ServerHandler.Name;
                    m_ServerHandler.AcceptManagerVisit(this, now);

                    cmpName = "purgeTimedOutCallSlots";
                    purgeTimedOutCallSlots(now);

                    cmpName = string.Empty;

                    try { Thread.Sleep(THREAD_GRANULARITY); }
                    catch (ThreadInterruptedException) { }
                }
                catch (Exception error)
                {
                    log(MessageType.CatastrophicError, error.Message, "GlueService.threadSpin(component: '{0}')".Args(cmpName), error);
                }
            }
        }