Пример #1
0
        /// <summary>生成标志
        /// </summary>
        private GenericsDataPoolIdentifier BuildIdentifier(GenericsDataPoolOption option)
        {
            var identifier = new GenericsDataPoolIdentifier()
            {
                Group    = option.Group,
                DataType = option.DataType
            };

            return(identifier);
        }
Пример #2
0
        public GenericsDataPool(ILogger <GenericsDataPool <T> > logger, IOptions <DataPoolOption> option, GenericsDataPoolOption <T> genericsOption, IDPoolKeyGenerator dPoolKeyGenerator)
        {
            _logger            = logger;
            _option            = option.Value;
            _genericsOption    = genericsOption;
            _dPoolKeyGenerator = dPoolKeyGenerator;

            Identifier = BuildIdentifier(_genericsOption);

            _cts = new CancellationTokenSource();

            _idSelector  = (Func <T, string>)_genericsOption.IdSelector;
            _processDict = new ConcurrentDictionary <string, DataFuture <T> >();
        }