private void initEngines(final ClassLoader loader) {
        Iterator<GremlinScriptEngineFactory> itty;
        try {
            final ServiceLoader<GremlinScriptEngineFactory> sl = AccessController.doPrivileged(
                    (PrivilegedAction<ServiceLoader<GremlinScriptEngineFactory>>) () -> getServiceLoader(loader));
            itty = sl.iterator();
        } catch (ServiceConfigurationError err) {
            logger.error("Can't find GremlinScriptEngineFactory providers: " + err.getMessage(), err);

            // do not throw any exception here. user may want to manager their own factories using this manager
            // by explicit registration (by registerXXX) methods.
            return;
        }

        try {
            while (itty.hasNext()) {
                try {
                    final GremlinScriptEngineFactory factory = itty.next();
                    factory.setCustomizerManager(this);
                    engineSpis.add(factory);
                } catch (ServiceConfigurationError err) {
                    logger.error("GremlinScriptEngineManager providers.next(): " + err.getMessage(), err);
                }
            }
        } catch (ServiceConfigurationError err) {
            logger.error("GremlinScriptEngineManager providers.hasNext(): " + err.getMessage(), err);
            // do not throw any exception here. user may want to manage their own factories using this manager
            // by explicit registration (by registerXXX) methods.
        }
    }
Registers a {@link GremlinScriptEngineFactory} to handle an extension. Overrides any such association found
using the discovery mechanism.

@param extension The extension type to be associated with the {@link GremlinScriptEngineFactory}
@param factory The class to associate with the given extension.
@throws NullPointerException if any of the parameters is null.
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/jsr223/DefaultGremlinScriptEngineManager.java