use of io.trino.plugin.base.jmx.MBeanServerModule in project trino by trinodb.
the class JmxConnectorFactory method create.
@Override
public Connector create(String catalogName, Map<String, String> config, ConnectorContext context) {
Bootstrap app = new Bootstrap(new MBeanServerModule(), binder -> {
configBinder(binder).bindConfig(JmxConnectorConfig.class);
binder.bind(NodeManager.class).toInstance(context.getNodeManager());
binder.bind(JmxConnector.class).in(Scopes.SINGLETON);
binder.bind(JmxHistoricalData.class).in(Scopes.SINGLETON);
binder.bind(JmxMetadata.class).in(Scopes.SINGLETON);
binder.bind(JmxSplitManager.class).in(Scopes.SINGLETON);
binder.bind(JmxPeriodicSampler.class).in(Scopes.SINGLETON);
binder.bind(JmxRecordSetProvider.class).in(Scopes.SINGLETON);
});
Injector injector = app.doNotInitializeLogging().setRequiredConfigurationProperties(config).initialize();
return injector.getInstance(JmxConnector.class);
}
use of io.trino.plugin.base.jmx.MBeanServerModule in project trino by trinodb.
the class DbResourceGroupConfigurationManagerFactory method create.
@Override
public ResourceGroupConfigurationManager<?> create(Map<String, String> config, ResourceGroupConfigurationManagerContext context) {
config = replaceEnvironmentVariables(config);
FlywayMigration.migrate(new ConfigurationFactory(config).build(DbResourceGroupConfig.class));
Bootstrap app = new Bootstrap(new MBeanModule(), new MBeanServerModule(), new JsonModule(), new DbResourceGroupsModule(), new PrefixObjectNameGeneratorModule("io.trino.plugin.resourcegroups.db", "trino.plugin.resourcegroups.db"), 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(DbResourceGroupConfigurationManager.class);
}
use of io.trino.plugin.base.jmx.MBeanServerModule in project trino by trinodb.
the class JdbcDiagnosticModule method configure.
@Override
public void configure(Binder binder) {
binder.install(new MBeanServerModule());
binder.install(new MBeanModule());
Provider<CatalogName> catalogName = binder.getProvider(CatalogName.class);
newExporter(binder).export(Key.get(JdbcClient.class, StatsCollecting.class)).as(generator -> generator.generatedNameOf(JdbcClient.class, catalogName.get().toString()));
newExporter(binder).export(Key.get(ConnectionFactory.class, StatsCollecting.class)).as(generator -> generator.generatedNameOf(ConnectionFactory.class, catalogName.get().toString()));
newExporter(binder).export(JdbcClient.class).as(generator -> generator.generatedNameOf(CachingJdbcClient.class, catalogName.get().toString()));
}
use of io.trino.plugin.base.jmx.MBeanServerModule in project trino by trinodb.
the class ElasticsearchConnectorFactory method create.
@Override
public Connector create(String catalogName, Map<String, String> config, ConnectorContext context) {
requireNonNull(catalogName, "catalogName is null");
requireNonNull(config, "config is null");
Bootstrap app = new Bootstrap(new MBeanModule(), new MBeanServerModule(), new ConnectorObjectNameGeneratorModule(catalogName, "io.trino.plugin.elasticsearch", "trino.plugin.elasticsearch"), new JsonModule(), new TypeDeserializerModule(context.getTypeManager()), new ElasticsearchConnectorModule(), binder -> {
binder.bind(NodeManager.class).toInstance(context.getNodeManager());
});
Injector injector = app.doNotInitializeLogging().setRequiredConfigurationProperties(config).initialize();
return injector.getInstance(ElasticsearchConnector.class);
}
use of io.trino.plugin.base.jmx.MBeanServerModule in project trino by trinodb.
the class ThriftConnectorFactory method create.
@Override
public Connector create(String catalogName, Map<String, String> config, ConnectorContext context) {
Bootstrap app = new Bootstrap(new MBeanModule(), new MBeanServerModule(), new ConnectorObjectNameGeneratorModule(catalogName, "io.trino.plugin.thrift", "trino.plugin.thrift"), new DriftNettyClientModule(), binder -> {
binder.bind(TypeManager.class).toInstance(context.getTypeManager());
}, locationModule, new ThriftModule());
Injector injector = app.doNotInitializeLogging().setRequiredConfigurationProperties(config).initialize();
return injector.getInstance(ThriftConnector.class);
}
Aggregations