use of com.facebook.presto.resourceGroups.reloading.ReloadingResourceGroupConfigurationManagerModule in project presto by prestodb.
the class H2ResourceGroupConfigurationManagerFactory method create.
@Override
public ResourceGroupConfigurationManager<VariableMap> create(Map<String, String> config, ResourceGroupConfigurationManagerContext context) {
try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(classLoader)) {
Bootstrap app = new Bootstrap(new JsonModule(), new H2ResourceGroupsModule(), new NodeModule(), new ReloadingResourceGroupConfigurationManagerModule(), binder -> binder.bind(ResourceGroupConfigurationManagerContext.class).toInstance(context), binder -> binder.bind(ClusterMemoryPoolManager.class).toInstance(context.getMemoryPoolManager()));
Injector injector = app.doNotInitializeLogging().setRequiredConfigurationProperties(config).quiet().initialize();
return injector.getInstance(ReloadingResourceGroupConfigurationManager.class);
} catch (Exception e) {
throwIfUnchecked(e);
throw new RuntimeException(e);
}
}
use of com.facebook.presto.resourceGroups.reloading.ReloadingResourceGroupConfigurationManagerModule in project presto by prestodb.
the class DbResourceGroupConfigurationManagerFactory method create.
@Override
public ResourceGroupConfigurationManager<VariableMap> create(Map<String, String> config, ResourceGroupConfigurationManagerContext context) {
try {
Bootstrap app = new Bootstrap(new JsonModule(), new DbResourceGroupsModule(), new ReloadingResourceGroupConfigurationManagerModule(), binder -> binder.bind(String.class).annotatedWith(ForEnvironment.class).toInstance(context.getEnvironment()), binder -> binder.bind(ClusterMemoryPoolManager.class).toInstance(context.getMemoryPoolManager()));
Injector injector = app.doNotInitializeLogging().setRequiredConfigurationProperties(config).initialize();
return injector.getInstance(ReloadingResourceGroupConfigurationManager.class);
} catch (Exception e) {
throwIfUnchecked(e);
throw new RuntimeException(e);
}
}
Aggregations