/** * Create a client instance. The supplied configuration is only used the first time and * ignored afterwords. Tests that want to supply different configurations * should call {@link #factoryReset(SentryServiceClientFactory)} to force new configuration * read. * @param conf Configuration * @return client instance * @throws Exception */ public static SentryPolicyServiceClient create(Configuration conf) throws Exception { SentryServiceClientFactory factory = clientFactory.get(); if (factory != null) { return factory.create(); } factory = new SentryServiceClientFactory(conf); boolean ok = clientFactory.compareAndSet(null, factory); if (ok) { return factory.create(); } // Close old factory factory.close(); return clientFactory.get().create(); }