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);
}
}
Aggregations