/** * Obtain an Generic policy client instance. * @param conf Configuration that should be used. Configuration is only used for the * initial creation and ignored afterwords. */ public static SentryGenericServiceClient create(Configuration conf) throws Exception { SentryGenericServiceClientFactory factory = clientFactory.get(); if (factory != null) { return factory.create(); } factory = new SentryGenericServiceClientFactory(conf); boolean ok = clientFactory.compareAndSet(null, factory); if (ok) { return factory.create(); } factory.close(); return clientFactory.get().create(); }
/** * The Sentry-296(generate client for connection pooling) has already finished development and reviewed by now. When it * was committed to master, the getClient method was needed to refactor using the connection pool * * TODO: Avoid creating new client each time. */ private SentryGenericServiceClient getClient() throws Exception { return SentryGenericServiceClientFactory.create(conf); }
@Override public SentryGenericServiceClient run() throws Exception { return SentryGenericServiceClientFactory.create(SentryServiceIntegrationBase.conf); } });
@Override public SentryGenericServiceClient run() throws Exception { return SentryGenericServiceClientFactory.create(conf); } });
/** * use the generic client to connect sentry service */ @Override public void connectToSentryService() throws Exception { if (SentryServiceIntegrationBase.kerberos) { this.client = SentryServiceIntegrationBase.clientUgi.doAs(new PrivilegedExceptionAction<SentryGenericServiceClient>() { @Override public SentryGenericServiceClient run() throws Exception { return SentryGenericServiceClientFactory.create(SentryServiceIntegrationBase.conf); } }); } else { this.client = SentryGenericServiceClientFactory.create(SentryServiceIntegrationBase.conf); } }
/** * use the generic client to connect sentry service */ @Override public void connectToSentryService() throws Exception { // The client should already be logged in when running in solr // therefore we must manually login in the integration tests if (kerberos) { this.client = clientUgi.doAs( new PrivilegedExceptionAction<SentryGenericServiceClient>() { @Override public SentryGenericServiceClient run() throws Exception { return SentryGenericServiceClientFactory.create(conf); } }); } else { this.client = SentryGenericServiceClientFactory.create(conf); } }