code: public static SentryClient sentryClient(String dsn, SentryClientFactory sentryClientFactory) {
          Dsn realDsn = resolveDsn(dsn);
  
          // If the caller didn't pass a factory, try to look one up
          if (sentryClientFactory == null) {
              String sentryClientFactoryName = Lookup.lookup("factory", realDsn);
              if (Util.isNullOrEmpty(sentryClientFactoryName)) {
                  // no name specified, use the default factory
                  sentryClientFactory = new DefaultSentryClientFactory();
              } else {
                  // attempt to construct the user specified factory class
                  Class<? extends SentryClientFactory> factoryClass = null;
                  try {
                      factoryClass = (Class<? extends SentryClientFactory>) Class.forName(sentryClientFactoryName);
                      sentryClientFactory = factoryClass.newInstance();
                  } catch (ClassNotFoundException | IllegalAccessException | InstantiationException e) {
                      logger.error("Error creating SentryClient using factory class: '"
                          + sentryClientFactoryName + "'.", e);
                      return null;
                  }
              }
          }
  
          return sentryClientFactory.createSentryClient(realDsn);
      }
docs: Creates an instance of Sentry using the provided DSN and the specified factory.
  
  @param dsn Data Source Name of the Sentry server.
  @param sentryClientFactory SentryClientFactory instance to use, or null to do a config lookup.
  @return SentryClient instance, or null if one couldn't be constructed.