private S newProvider(final Class<S> cls) {
        LOG.info("SPI service [{} - {}] loading.", this.service.getName(), cls.getName());
        try {
            final S provider = this.service.cast(cls.newInstance());
            this.providers.put(cls.getName(), provider);
            return provider;
        } catch (final Throwable x) {
            throw fail(this.service, "provider " + cls.getName() + " could not be instantiated", x);
        }
    }
A simple service-provider loading facility (SPI).

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