Search in sources :

Example 1 with RebindSafeMBeanServer

use of com.facebook.presto.connector.thrift.util.RebindSafeMBeanServer in project presto by prestodb.

the class ThriftConnectorFactory method create.

@Override
public Connector create(String catalogName, Map<String, String> config, ConnectorContext context) {
    try {
        Bootstrap app = new Bootstrap(new MBeanModule(), new DriftNettyClientModule(), binder -> {
            binder.bind(MBeanServer.class).toInstance(new RebindSafeMBeanServer(getPlatformMBeanServer()));
            binder.bind(TypeManager.class).toInstance(context.getTypeManager());
        }, locationModule, new ThriftModule(catalogName));
        Injector injector = app.doNotInitializeLogging().setRequiredConfigurationProperties(config).initialize();
        return injector.getInstance(ThriftConnector.class);
    } catch (Exception e) {
        throwIfUnchecked(e);
        throw new RuntimeException(e);
    }
}
Also used : MBeanModule(org.weakref.jmx.guice.MBeanModule) RebindSafeMBeanServer(com.facebook.presto.connector.thrift.util.RebindSafeMBeanServer) DriftNettyClientModule(com.facebook.drift.transport.netty.client.DriftNettyClientModule) Injector(com.google.inject.Injector) Bootstrap(com.facebook.airlift.bootstrap.Bootstrap) TypeManager(com.facebook.presto.common.type.TypeManager) RebindSafeMBeanServer(com.facebook.presto.connector.thrift.util.RebindSafeMBeanServer) ManagementFactory.getPlatformMBeanServer(java.lang.management.ManagementFactory.getPlatformMBeanServer) MBeanServer(javax.management.MBeanServer)

Aggregations

Bootstrap (com.facebook.airlift.bootstrap.Bootstrap)1 DriftNettyClientModule (com.facebook.drift.transport.netty.client.DriftNettyClientModule)1 TypeManager (com.facebook.presto.common.type.TypeManager)1 RebindSafeMBeanServer (com.facebook.presto.connector.thrift.util.RebindSafeMBeanServer)1 Injector (com.google.inject.Injector)1 ManagementFactory.getPlatformMBeanServer (java.lang.management.ManagementFactory.getPlatformMBeanServer)1 MBeanServer (javax.management.MBeanServer)1 MBeanModule (org.weakref.jmx.guice.MBeanModule)1