Search in sources :

Example 1 with RebindSafeMBeanServer

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);
    }
}
Also used : NodeManager(com.facebook.presto.spi.NodeManager) RebindSafeMBeanServer(com.facebook.presto.connector.jmx.util.RebindSafeMBeanServer) Injector(com.google.inject.Injector) Bootstrap(io.airlift.bootstrap.Bootstrap) MBeanServer(javax.management.MBeanServer) RebindSafeMBeanServer(com.facebook.presto.connector.jmx.util.RebindSafeMBeanServer)

Aggregations

RebindSafeMBeanServer (com.facebook.presto.connector.jmx.util.RebindSafeMBeanServer)1 NodeManager (com.facebook.presto.spi.NodeManager)1 Injector (com.google.inject.Injector)1 Bootstrap (io.airlift.bootstrap.Bootstrap)1 MBeanServer (javax.management.MBeanServer)1