/
vshmidt
/
masstransit
Обзор
Документация
Войти
/
vshmidt
/
masstransit
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
src/MassTransit/Monitoring/Performance/ConsumerPerformanceCounterCache.cs
30 строк
1015 B
Denys Kozhevnikov
Code cleanup. Remove copyrights
29 май 2020, 12:54
29 май 2020, 12:54
d017e8d
Код
Авторство
О чём код?
namespace MassTransit.Monitoring.Performance { using System; using System.Collections.Concurrent; public class ConsumerPerformanceCounterCache { readonly ConcurrentDictionary<string, Lazy<ConsumerPerformanceCounter>> _types; ConsumerPerformanceCounterCache() { _types = new ConcurrentDictionary<string, Lazy<ConsumerPerformanceCounter>>(); } public static IConsumerPerformanceCounter GetCounter(ICounterFactory factory, string consumerType) { return Cached.Counter.Value._types .GetOrAdd(consumerType, x => new Lazy<ConsumerPerformanceCounter>(() => new ConsumerPerformanceCounter(factory, x))) .Value; } static class Cached { public static readonly Lazy<ConsumerPerformanceCounterCache> Counter = new Lazy<ConsumerPerformanceCounterCache>(() => new ConsumerPerformanceCounterCache()); } } }