Пример #1
0
        public CustomerCodeTaskInstance Get(IIdentityProvider provider, Func <ITask> reindexAllTaskAccessor)
        {
            var customerCode = provider.Identity?.CustomerCode;
            CustomerCodeTaskInstance result =
                GetCustomerCodeTaskInstance(provider, customerCode, reindexAllTaskAccessor, _delays);

            return(result);
        }
Пример #2
0
        private CustomerCodeTaskInstance GetCustomerCodeTaskInstance(
            IIdentityProvider provider,
            string customerCode,
            Func <ITask> reindexAllTaskAccessor,
            TaskRunnerDelays delays
            )
        {
            CustomerCodeTaskInstance result = null;

            if (customerCode == null || _taskList.TryGetValue(customerCode, out result))
            {
                return(result);
            }
            lock (Locker)
            {
                if (!_taskList.TryGetValue(customerCode, out result))
                {
                    result = new CustomerCodeTaskInstance(provider, reindexAllTaskAccessor(), delays, _consolidationFactory);
                    _taskList.Add(customerCode, result);
                }
            }
            return(result);
        }