private boolean shouldAdd(LockAttempt lockAttempt) {
        LockAttempt existingLockAttempt = byLockPath.get(lockAttempt.getLockPath());
        if (existingLockAttempt != null) {
            if (hasLongerDurationThan(lockAttempt, existingLockAttempt)) {
                byLockPath.remove(existingLockAttempt.getLockPath());
                priorityQueue.remove(existingLockAttempt);
                return true;
            }

            return false;
        }

        if (size() < maxSamples) {
            return true;
        }

        // peek() and poll() retrieves the smallest element.
        existingLockAttempt = priorityQueue.peek();  // cannot be null
        if (hasLongerDurationThan(lockAttempt, existingLockAttempt)) {
            priorityQueue.poll();
            byLockPath.remove(existingLockAttempt.getLockPath());
            return true;
        }

        return false;
    }
Priority queue containing all samples.  The head of this queue (peek()/poll())
returns the LockAttempt with the smallest duration.
zkfacade/src/main/java/com/yahoo/vespa/curator/stats/LockAttemptSamples.java