Search in sources :

Example 1 with NodeTtlFetcher

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);
    }
}
Also used : NodeTtlFetcher(com.facebook.presto.spi.ttl.NodeTtlFetcher) Injector(com.google.inject.Injector) Bootstrap(com.facebook.airlift.bootstrap.Bootstrap)

Example 2 with NodeTtlFetcher

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);
}
Also used : NodeTtlFetcherFactory(com.facebook.presto.spi.ttl.NodeTtlFetcherFactory) NodeTtlFetcher(com.facebook.presto.spi.ttl.NodeTtlFetcher) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Aggregations

NodeTtlFetcher (com.facebook.presto.spi.ttl.NodeTtlFetcher)2 Bootstrap (com.facebook.airlift.bootstrap.Bootstrap)1 NodeTtlFetcherFactory (com.facebook.presto.spi.ttl.NodeTtlFetcherFactory)1 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 Injector (com.google.inject.Injector)1