private Label createLabel(String string) {
        // Need a lock to avoid creating the same label twice if another thread is creating the same label.
        var lock = stripedLock.get(string);
        lock.lock();

        try {
            // Try to get the label in case another thread has already created one while we were waiting for the lock.
            var existingLabel = getLabel(string);
            if (existingLabel != null) {
                return existingLabel;
            }

            var newNumeric = uniqueCounter.getAndDecrement();
            var newLabel = new LabelImpl(newNumeric, string);
            var newReference = new LabelWeakReference(newLabel, referenceQueue);

            byString.put(string, newReference);
            byNumeric.put(newNumeric, newReference);

            return newLabel;
        } finally {
            lock.unlock();
            removeStaleReferences();
        }
    }
Creates a label cache.

@param lockStripes number of lock stripes, should be proportional to the number of threads using the cache.
@param smallIndexSize size of a cache used to store pre-computed labels for small index labels.
vespajlib/src/main/java/com/yahoo/tensor/impl/LabelCache.java