Пример #1
0
        public long Increment(string[] names, int count)
        {
            long answer = 0;

            foreach (var name in names)
            {
                var lowerName = name.ToLower();
                var counter   = new AtomicLong(count);
                answer = counters.AddOrUpdate(lowerName, counter, (k, v) => new AtomicLong(v.Value + counter.Value)).Value;
            }

            return(answer);
        }
Пример #2
0
        public bool Equals(AtomicLong other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return(other.value == value);
        }