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 ) ; }
Creates an instance of Sentry using the provided DSN and the specified factory .