use of com.facebook.presto.spi.ttl.NodeTtlFetcher in project presto by prestodb.
the class InfiniteNodeTtlFetcherFactory method create.
@Override
public NodeTtlFetcher create(Map<String, String> config) {
try {
Bootstrap app = new Bootstrap(binder -> binder.bind(NodeTtlFetcher.class).to(InfiniteNodeTtlFetcher.class).in(Scopes.SINGLETON));
Injector injector = app.doNotInitializeLogging().setRequiredConfigurationProperties(config).initialize();
return injector.getInstance(NodeTtlFetcher.class);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of com.facebook.presto.spi.ttl.NodeTtlFetcher in project presto by prestodb.
the class ConfidenceBasedNodeTtlFetcherManager method load.
@VisibleForTesting
public void load(String factoryName, Map<String, String> properties) {
log.info("-- Loading node ttl fetcher factory --");
NodeTtlFetcherFactory nodeTtlFetcherFactory = ttlFetcherFactories.get(factoryName);
checkState(nodeTtlFetcherFactory != null, "Node ttl fetcher factory %s is not registered", factoryName);
NodeTtlFetcher nodeTtlFetcher = nodeTtlFetcherFactory.create(properties);
checkState(this.ttlFetcher.compareAndSet(null, nodeTtlFetcher), "Node ttl fetcher has already been set!");
log.info("-- Loaded node ttl fetcher %s --", factoryName);
}
Aggregations