public S find(final String implName) {
        for (final S s : this.providers.values()) {
            final SPI spi = s.getClass().getAnnotation(SPI.class);
            if (spi != null && spi.name().equalsIgnoreCase(implName)) {
                return s;
            }
        }
        while (this.lookupIterator.hasNext()) {
            final Class<S> cls = this.lookupIterator.next();
            final SPI spi = cls.getAnnotation(SPI.class);
            if (spi != null && spi.name().equalsIgnoreCase(implName)) {
                try {
                    return newProvider(cls);
                } catch (final Throwable x) {
                    throw fail(this.service, "provider " + cls.getName() + " could not be instantiated", x);
                }
            }
        }
        throw fail(this.service, "provider " + implName + " not found");
    }
A simple service-provider loading facility (SPI).

@author jiachun.fjc
jraft-core/src/main/java/com/alipay/sofa/jraft/util/JRaftServiceLoader.java