Search in sources :

Example 1 with RebindSafeMBeanServer

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

the class RaptorConnectorFactory method create.

@Override
public Connector create(String catalogName, Map<String, String> config, ConnectorContext context) {
    NodeManager nodeManager = context.getNodeManager();
    try {
        Bootstrap app = new Bootstrap(new JsonModule(), new MBeanModule(), binder -> {
            MBeanServer mbeanServer = new RebindSafeMBeanServer(getPlatformMBeanServer());
            binder.bind(MBeanServer.class).toInstance(mbeanServer);
            binder.bind(NodeManager.class).toInstance(nodeManager);
            binder.bind(PageSorter.class).toInstance(context.getPageSorter());
            binder.bind(TypeManager.class).toInstance(context.getTypeManager());
        }, metadataModule, new FileSystemModule(fileSystemProviders), new BackupModule(backupProviders), new StorageModule(catalogName), new RaptorModule(catalogName), new RaptorSecurityModule(), new RaptorProcedureModule());
        Injector injector = app.doNotInitializeLogging().setRequiredConfigurationProperties(config).initialize();
        return injector.getInstance(RaptorConnector.class);
    } catch (Exception e) {
        throwIfUnchecked(e);
        throw new RuntimeException(e);
    }
}
Also used : MBeanModule(org.weakref.jmx.guice.MBeanModule) StorageModule(com.facebook.presto.raptor.storage.StorageModule) BackupModule(com.facebook.presto.raptor.backup.BackupModule) RaptorSecurityModule(com.facebook.presto.raptor.security.RaptorSecurityModule) JsonModule(com.facebook.airlift.json.JsonModule) NodeManager(com.facebook.presto.spi.NodeManager) FileSystemModule(com.facebook.presto.raptor.filesystem.FileSystemModule) RebindSafeMBeanServer(com.facebook.presto.raptor.util.RebindSafeMBeanServer) Injector(com.google.inject.Injector) Bootstrap(com.facebook.airlift.bootstrap.Bootstrap) PageSorter(com.facebook.presto.spi.PageSorter) TypeManager(com.facebook.presto.common.type.TypeManager) ManagementFactory.getPlatformMBeanServer(java.lang.management.ManagementFactory.getPlatformMBeanServer) MBeanServer(javax.management.MBeanServer) RebindSafeMBeanServer(com.facebook.presto.raptor.util.RebindSafeMBeanServer)

Aggregations

Bootstrap (com.facebook.airlift.bootstrap.Bootstrap)1 JsonModule (com.facebook.airlift.json.JsonModule)1 TypeManager (com.facebook.presto.common.type.TypeManager)1 BackupModule (com.facebook.presto.raptor.backup.BackupModule)1 FileSystemModule (com.facebook.presto.raptor.filesystem.FileSystemModule)1 RaptorSecurityModule (com.facebook.presto.raptor.security.RaptorSecurityModule)1 StorageModule (com.facebook.presto.raptor.storage.StorageModule)1 RebindSafeMBeanServer (com.facebook.presto.raptor.util.RebindSafeMBeanServer)1 NodeManager (com.facebook.presto.spi.NodeManager)1 PageSorter (com.facebook.presto.spi.PageSorter)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