Exemplo n.º 1
0
        protected AsynchAgent(string nameSuffix)
        {
            Cts = new CancellationTokenSource();
            var thisType = GetType();
            
            type = thisType.Namespace + "." + thisType.Name;
            if (type.StartsWith("Orleans.", StringComparison.Ordinal))
            {
                type = type.Substring(8);
            }
            if (!string.IsNullOrEmpty(nameSuffix))
            {
                Name = type + "/" + nameSuffix;
            }
            else
            {
                Name = type;
            }

            Lockable = new object();
            State = ThreadState.Unstarted;
            OnFault = FaultBehavior.IgnoreFault;
            Log = TraceLogger.GetLogger(Name, TraceLogger.LoggerType.Runtime);
            AppDomain.CurrentDomain.DomainUnload += CurrentDomain_DomainUnload;

#if TRACK_DETAILED_STATS
            if (StatisticsCollector.CollectThreadTimeTrackingStats)
            {
                threadTracking = new ThreadTrackingStatistic(Name);
            }
#endif
            t = new Thread(AgentThreadProc) { IsBackground = true, Name = this.Name };
        }
Exemplo n.º 2
0
        protected AsynchAgent(string nameSuffix, ExecutorService executorService, ILoggerFactory loggerFactory)
        {
            this.executorService = executorService;
            Cts = new CancellationTokenSource();
            var thisType = GetType();

            type = thisType.Namespace + "." + thisType.Name;
            if (type.StartsWith("Orleans.", StringComparison.Ordinal))
            {
                type = type.Substring(8);
            }
            if (!string.IsNullOrEmpty(nameSuffix))
            {
                Name = type + "/" + nameSuffix;
            }
            else
            {
                Name = type;
            }

            Lockable = new object();
            State    = ThreadState.Unstarted;
            OnFault  = FaultBehavior.IgnoreFault;
            Log      = loggerFactory.CreateLogger(Name);

            AppDomain.CurrentDomain.DomainUnload += CurrentDomain_DomainUnload;

#if TRACK_DETAILED_STATS
            if (StatisticsCollector.CollectThreadTimeTrackingStats)
            {
                threadTracking = new ThreadTrackingStatistic(Name);
            }
#endif
        }
Exemplo n.º 3
0
        protected TaskSchedulerAgent(string nameSuffix, ILoggerFactory loggerFactory)
        {
            Cts = new CancellationTokenSource();
            var thisType = GetType();

            type = thisType.Namespace + "." + thisType.Name;
            if (type.StartsWith("Orleans.", StringComparison.Ordinal))
            {
                type = type.Substring(8);
            }
            if (!string.IsNullOrEmpty(nameSuffix))
            {
                Name = type + "/" + nameSuffix;
            }
            else
            {
                Name = type;
            }

            Lockable = new object();
            OnFault  = FaultBehavior.IgnoreFault;

            this.loggerFactory = loggerFactory;
            this.Log           = loggerFactory.CreateLogger(Name);
        }
Exemplo n.º 4
0
        protected AsynchAgent(string nameSuffix, ExecutorService executorService, ILoggerFactory loggerFactory)
        {
            Cts = new CancellationTokenSource();
            var thisType = GetType();

            type = thisType.Namespace + "." + thisType.Name;
            if (type.StartsWith("Orleans.", StringComparison.Ordinal))
            {
                type = type.Substring(8);
            }
            if (!string.IsNullOrEmpty(nameSuffix))
            {
                Name = type + "/" + nameSuffix;
            }
            else
            {
                Name = type;
            }

            Lockable = new object();
            State    = ThreadState.Unstarted;
            OnFault  = FaultBehavior.IgnoreFault;

            this.loggerFactory        = loggerFactory;
            this.Log                  = loggerFactory.CreateLogger(Name);
            this.executorService      = executorService;
            this.executorFaultHandler = new ExecutorFaultHandler(this);
        }
        protected TaskSchedulerAgent(ILoggerFactory loggerFactory)
        {
            Cts = new CancellationTokenSource();

            this.Log = loggerFactory.CreateLogger(this.GetType());
            var typeName = GetType().FullName;

            if (typeName.StartsWith("Orleans.", StringComparison.Ordinal))
            {
                typeName = typeName.Substring(8);
            }

            Name = typeName;

            Lockable = new object();
            OnFault  = FaultBehavior.IgnoreFault;
        }
Exemplo n.º 6
0
        protected AsynchAgent(string nameSuffix)
        {
            Cts = new CancellationTokenSource();
            var thisType = GetType();
            int n        = 0;

            lock (classLockable)
            {
                SequenceNumbers.TryGetValue(thisType, out n);
                n++;
                SequenceNumbers[thisType] = n;
            }

            type = thisType.Namespace + "." + thisType.Name;
            if (type.StartsWith("Orleans.", StringComparison.Ordinal))
            {
                type = type.Substring(8);
            }
            if (!string.IsNullOrEmpty(nameSuffix))
            {
                Name = type + "." + nameSuffix + "/" + n;
            }
            else
            {
                Name = type + "/" + n;
            }

            Lockable = new object();
            State    = ThreadState.Unstarted;
            OnFault  = FaultBehavior.IgnoreFault;
            Log      = TraceLogger.GetLogger(Name, TraceLogger.LoggerType.Runtime);
            AppDomain.CurrentDomain.DomainUnload += new EventHandler(CurrentDomain_DomainUnload);

#if TRACK_DETAILED_STATS
            if (StatisticsCollector.CollectThreadTimeTrackingStats)
            {
                threadTracking = new ThreadTrackingStatistic(Name);
            }
#endif

            t = new Thread(AgentThreadProc)
            {
                IsBackground = true, Name = this.Name
            };
        }
Exemplo n.º 7
0
        protected AsynchAgent(string nameSuffix)
        {
            Cts = new CancellationTokenSource();
            var thisType = GetType();

            type = thisType.Namespace + "." + thisType.Name;
            if (type.StartsWith("Orleans.", StringComparison.Ordinal))
            {
                type = type.Substring(8);
            }
            if (!string.IsNullOrEmpty(nameSuffix))
            {
                Name = type + "/" + nameSuffix;
            }
            else
            {
                Name = type;
            }

            Lockable = new object();
            State    = ThreadState.Unstarted;
            OnFault  = FaultBehavior.IgnoreFault;
            Log      = LogManager.GetLogger(Name, LoggerType.Runtime);
#if !NETSTANDARD
            AppDomain.CurrentDomain.DomainUnload += CurrentDomain_DomainUnload;
#endif

#if TRACK_DETAILED_STATS
            if (StatisticsCollector.CollectThreadTimeTrackingStats)
            {
                threadTracking = new ThreadTrackingStatistic(Name);
            }
#endif
            t = new Thread(AgentThreadProc)
            {
                IsBackground = true, Name = this.Name
            };
        }