use of io.micrometer.core.instrument.util.NamedThreadFactory in project zipkin by openzipkin.
the class ZipkinElasticsearchStorageConfiguration method dynamicCredentialsScheduledExecutorService.
@Bean(destroyMethod = "shutdown")
@Qualifier(QUALIFIER)
@Conditional(DynamicRefreshRequired.class)
ScheduledExecutorService dynamicCredentialsScheduledExecutorService(@Value("${" + CREDENTIALS_FILE + "}") String credentialsFile, @Value("${" + CREDENTIALS_REFRESH_INTERVAL + "}") Integer credentialsRefreshInterval, @Qualifier(QUALIFIER) BasicCredentials basicCredentials) throws IOException {
ScheduledExecutorService ses = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("zipkin-load-es-credentials"));
DynamicCredentialsFileLoader credentialsFileLoader = new DynamicCredentialsFileLoader(basicCredentials, credentialsFile);
credentialsFileLoader.updateCredentialsFromProperties();
ScheduledFuture<?> future = ses.scheduleAtFixedRate(credentialsFileLoader, 0, credentialsRefreshInterval, TimeUnit.SECONDS);
if (future.isDone())
throw new RuntimeException("credential refresh thread didn't start");
return ses;
}
Aggregations