use of com.facebook.presto.connector.jmx.util.RebindSafeMBeanServer in project presto by prestodb.
the class JmxConnectorFactory method create.
@Override
public Connector create(String connectorId, Map<String, String> config, ConnectorContext context) {
try {
Bootstrap app = new Bootstrap(binder -> {
configBinder(binder).bindConfig(JmxConnectorConfig.class);
binder.bind(MBeanServer.class).toInstance(new RebindSafeMBeanServer(mbeanServer));
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.strictConfig().doNotInitializeLogging().setRequiredConfigurationProperties(config).initialize();
return injector.getInstance(JmxConnector.class);
} catch (Exception e) {
throw Throwables.propagate(e);
}
}
Aggregations