A task scheduler for IConsumerQueueScheduler
상속: System.Threading.Tasks.TaskScheduler, ITaskScheduler
 /// <summary>
 /// Creates the task factory.
 /// </summary>
 /// <param name="scheduler">The scheduler.</param>
 /// <param name="weOwnScheduler">if set to <c>true</c> [we own scheduler].</param>
 /// <returns></returns>
 private ITaskFactory CreateTaskFactoryInternal(ATaskScheduler scheduler, bool weOwnScheduler)
 {
     if (weOwnScheduler)
     {
         var container = _createContainerInternal().Create(QueueContexts.TaskFactory, _registerService, _transportInit,
                                                           serviceRegister => serviceRegister.Register(() => scheduler, LifeStyles.Singleton), _setOptions);
         Containers.Add(container);
         return(container.GetInstance <ITaskFactory>());
     }
     else
     {
         var container = _createContainerInternal().Create(QueueContexts.TaskFactory, _registerService, _transportInit,
                                                           serviceRegister => serviceRegister.RegisterNonScopedSingleton(scheduler), _setOptions);
         Containers.Add(container);
         return(container.GetInstance <ITaskFactory>());
     }
 }
예제 #2
0
 /// <summary>
 /// Creates the task factory.
 /// </summary>
 /// <param name="scheduler">The scheduler.</param>
 /// <returns></returns>
 public ITaskFactory CreateTaskFactory(ATaskScheduler scheduler)
 {
     return CreateTaskFactoryInternal(scheduler, false);
 }
예제 #3
0
        /// <summary>
        /// Creates the task factory.
        /// </summary>
        /// <param name="scheduler">The scheduler.</param>
        /// <param name="weOwnScheduler">if set to <c>true</c> [we own scheduler].</param>
        /// <returns></returns>
        private ITaskFactory CreateTaskFactoryInternal(ATaskScheduler scheduler, bool weOwnScheduler)
        {
            if (weOwnScheduler)
            {
                var container = _createContainerInternal().Create(QueueContexts.TaskFactory, _registerService, _transportInit,
                 serviceRegister => serviceRegister.Register(() => scheduler, LifeStyles.Singleton), _setOptions);
                Containers.Add(container);
                return container.GetInstance<ITaskFactory>();

            }
            else
            {
                var container = _createContainerInternal().Create(QueueContexts.TaskFactory, _registerService, _transportInit,
                    serviceRegister => serviceRegister.RegisterNonScopedSingleton(scheduler), _setOptions);
                Containers.Add(container);
                return container.GetInstance<ITaskFactory>();
            }
        }
 /// <summary>
 /// Creates the task factory.
 /// </summary>
 /// <param name="scheduler">The scheduler.</param>
 /// <returns></returns>
 public ITaskFactory CreateTaskFactory(ATaskScheduler scheduler)
 {
     return(CreateTaskFactoryInternal(scheduler, false));
 }