public TaskConcurrency peek()

in concurrency-loadbalancer-core/src/main/java/com/uber/concurrency/loadbalancer/HeapConcurrencyLoadBalancer.java [110:126]


        public TaskConcurrency<T> peek() {
            if (size == 0) {
                return null;
            }

            /**
             * on completion of failed requests, instead of reducing task concurrency right away
             * we reduce concurrency with delay to avoid more number of requests assigned to failed task
             * syncState() will check scheduledCounter to see if there is matured count can be reduced
             */
            int index = iter.get();
            if (iter.compareAndSet(index, (index+1) % size)) {
                taskConcurrences.get(index).syncState();
            }

            return queue.peek();
        }