当前位置: 首页>>代码示例>>Java>>正文


Java MBeanModule类代码示例

本文整理汇总了Java中org.weakref.jmx.guice.MBeanModule的典型用法代码示例。如果您正苦于以下问题:Java MBeanModule类的具体用法?Java MBeanModule怎么用?Java MBeanModule使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MBeanModule类属于org.weakref.jmx.guice包,在下文中一共展示了MBeanModule类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configure

import org.weakref.jmx.guice.MBeanModule; //导入依赖的package包/类
@Override
protected void configure()
{
    Multibinder.newSetBinder(binder(), CallableWrapper.class, annotation);

    PoolProvider poolProvider = new PoolProvider();

    bind (ExecutorService.class).annotatedWith(annotation).toProvider(poolProvider).in(Scopes.SINGLETON);
    bind (ExecutorServiceManagementBean.class).annotatedWith(annotation).toProvider(poolProvider.getManagementProvider());
    MBeanModule.newExporter(binder()).export(ExecutorServiceManagementBean.class).annotatedWith(annotation).as(createMBeanName());

    if (timingWrapperEnabled) {
        bindWrapper(binder()).toProvider(new TimerWrapperProvider(threadPoolName));
    }
    if (threadDelegatingWrapperEnabled) {
        bindWrapper(binder()).toInstance(ThreadDelegatingDecorator.THREAD_DELEGATING_WRAPPER);
    }
}
 
开发者ID:NessComputing,项目名称:components-ness-executors,代码行数:19,代码来源:NessThreadPoolModule.java

示例2: main

import org.weakref.jmx.guice.MBeanModule; //导入依赖的package包/类
public static void main(String[] args)
        throws Exception
{
    if (System.getProperty("config", null) == null) {
        System.setProperty("config", "etc/controller.properties");
    }

    Bootstrap bootstrap = new Bootstrap(
            new NodeModule(),
            new DiscoveryModule(),
            new DiscoveryServerModule(),
            new HttpEventModule(),
            new HttpServerModule(),
            new JsonModule(),
            new JaxrsModule(true), // requireExplicitBindings = true'
            new JmxModule(),
            new MBeanModule(),
            new JsonReaderModule(false),
            new ControllerServerModule()
    );

    try {
        bootstrap.strictConfig().initialize();
    }
    catch (Exception e) {
        LOG.error(e, "Error starting server");
    }
}
 
开发者ID:prestodb,项目名称:presto-manager,代码行数:29,代码来源:ControllerServer.java

示例3: create

import org.weakref.jmx.guice.MBeanModule; //导入依赖的package包/类
@Override
public Connector create(String connectorId, Map<String, String> config)
{
    try {
        Bootstrap app = new Bootstrap(
                new JsonModule(),
                new MBeanModule(),
                binder -> {
                    CurrentNodeId currentNodeId = new CurrentNodeId(nodeManager.getCurrentNode().getNodeIdentifier());
                    MBeanServer mbeanServer = new RebindSafeMBeanServer(getPlatformMBeanServer());

                    binder.bind(MBeanServer.class).toInstance(mbeanServer);
                    binder.bind(CurrentNodeId.class).toInstance(currentNodeId);
                    binder.bind(NodeManager.class).toInstance(nodeManager);
                    binder.bind(PageSorter.class).toInstance(pageSorter);
                    binder.bind(BlockEncodingSerde.class).toInstance(blockEncodingSerde);
                    binder.bind(TypeManager.class).toInstance(typeManager);
                },
                metadataModule,
                new BackupModule(backupProviders),
                new StorageModule(connectorId),
                new RaptorModule(connectorId));

        Injector injector = app
                .strictConfig()
                .doNotInitializeLogging()
                .setRequiredConfigurationProperties(config)
                .setOptionalConfigurationProperties(optionalConfig)
                .initialize();

        return injector.getInstance(RaptorConnector.class);
    }
    catch (Exception e) {
        throw Throwables.propagate(e);
    }
}
 
开发者ID:y-lan,项目名称:presto,代码行数:37,代码来源:RaptorConnectorFactory.java

示例4: TestingDiscoveryServer

import org.weakref.jmx.guice.MBeanModule; //导入依赖的package包/类
public TestingDiscoveryServer(String environment)
        throws Exception
{
    tempDir = Files.createTempDir();

    Map<String, String> serverProperties = ImmutableMap.<String, String>builder()
            .put("static.db.location", tempDir.getAbsolutePath())
            .put("discovery.store-cache-ttl", "0ms")
            .build();

    Bootstrap app = new Bootstrap(
            new MBeanModule(),
            new TestingNodeModule(environment),
            new TestingHttpServerModule(),
            new JsonModule(),
            new JaxrsModule(true),
            new DiscoveryServerModule(),
            new DiscoveryModule(),
            new TestingJmxModule());

    Injector injector = app
            .strictConfig()
            .doNotInitializeLogging()
            .setRequiredConfigurationProperties(serverProperties)
            .initialize();

    lifeCycleManager = injector.getInstance(LifeCycleManager.class);

    server = injector.getInstance(TestingHttpServer.class);
}
 
开发者ID:y-lan,项目名称:presto,代码行数:31,代码来源:TestingDiscoveryServer.java

示例5: create

import org.weakref.jmx.guice.MBeanModule; //导入依赖的package包/类
@Override
public Connector create(String connectorId, Map<String, String> config)
{
    requireNonNull(config, "config is null");

    try {
        Bootstrap app = new Bootstrap(
                new MBeanModule(),
                new JsonModule(),
                new CassandraClientModule(connectorId),
                new Module()
                {
                    @Override
                    public void configure(Binder binder)
                    {
                        MBeanServer platformMBeanServer = ManagementFactory.getPlatformMBeanServer();
                        binder.bind(MBeanServer.class).toInstance(new RebindSafeMBeanServer(platformMBeanServer));
                    }
                });

        Injector injector = app.strictConfig().doNotInitializeLogging()
                .setRequiredConfigurationProperties(config)
                .setOptionalConfigurationProperties(optionalConfig).initialize();

        return injector.getInstance(CassandraConnector.class);
    }
    catch (Exception e) {
        throw Throwables.propagate(e);
    }
}
 
开发者ID:y-lan,项目名称:presto,代码行数:31,代码来源:CassandraConnectorFactory.java

示例6: configure

import org.weakref.jmx.guice.MBeanModule; //导入依赖的package包/类
@Override
public void configure()
{
    install(new MBeanModule());
    binder().bind(MBeanServer.class).toInstance(ManagementFactory.getPlatformMBeanServer());
    binder().bind(JmxAgent.class).asEagerSingleton();
}
 
开发者ID:treasure-data,项目名称:digdag,代码行数:8,代码来源:JmxModule.java

示例7: run

import org.weakref.jmx.guice.MBeanModule; //导入依赖的package包/类
@Override
public void run()
{
    verifyJvmRequirements();
    verifySystemTimeIsReasonable();

    Logger log = Logger.get(PrestoServer.class);

    ImmutableList.Builder<Module> modules = ImmutableList.builder();
    modules.add(
            new NodeModule(),
            new DiscoveryModule(),
            new HttpServerModule(),
            new JsonModule(),
            new JaxrsModule(true),
            new MBeanModule(),
            new JmxModule(),
            new JmxHttpModule(),
            new LogJmxModule(),
            new TraceTokenModule(),
            new JsonEventModule(),
            new HttpEventModule(),
            new EmbeddedDiscoveryModule(),
            new ServerSecurityModule(),
            new AccessControlModule(),
            new ServerMainModule(sqlParserOptions),
            new GracefulShutdownModule(),
            installModuleIf(
                    NodeSchedulerConfig.class,
                    config -> LEGACY_NETWORK_TOPOLOGY.equalsIgnoreCase(config.getNetworkTopology()),
                    binder -> binder.bind(NetworkTopology.class).to(LegacyNetworkTopology.class).in(Scopes.SINGLETON)),
            installModuleIf(
                    NodeSchedulerConfig.class,
                    config -> "flat".equalsIgnoreCase(config.getNetworkTopology()),
                    binder -> binder.bind(NetworkTopology.class).to(FlatNetworkTopology.class).in(Scopes.SINGLETON))

    );

    modules.addAll(getAdditionalModules());

    Bootstrap app = new Bootstrap(modules.build());

    try {
        Injector injector = app.strictConfig().initialize();

        injector.getInstance(PluginManager.class).loadPlugins();

        injector.getInstance(CatalogManager.class).loadCatalogs();

        // TODO: remove this huge hack
        updateDatasources(
                injector.getInstance(Announcer.class),
                injector.getInstance(Metadata.class),
                injector.getInstance(ServerConfig.class),
                injector.getInstance(NodeSchedulerConfig.class));

        injector.getInstance(AccessControlManager.class).loadSystemAccessControl();

        injector.getInstance(Announcer.class).start();

        log.info("======== SERVER STARTED ========");
    }
    catch (Throwable e) {
        log.error(e);
        System.exit(1);
    }
}
 
开发者ID:y-lan,项目名称:presto,代码行数:68,代码来源:PrestoServer.java

示例8: create

import org.weakref.jmx.guice.MBeanModule; //导入依赖的package包/类
@Override
public Connector create(String connectorId, Map<String, String> config)
{
    requireNonNull(config, "config is null");

    try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(classLoader)) {
        Bootstrap app = new Bootstrap(
                new NodeModule(),
                new MBeanModule(),
                new JsonModule(),
                new HiveClientModule(connectorId, metastore, typeManager, pageIndexerFactory),
                installModuleIf(
                        SecurityConfig.class,
                        security -> ALLOW_ALL_ACCESS_CONTROL.equalsIgnoreCase(security.getSecuritySystem()),
                        new NoSecurityModule()),
                installModuleIf(
                        SecurityConfig.class,
                        security -> "read-only".equalsIgnoreCase(security.getSecuritySystem()),
                        new ReadOnlySecurityModule()),
                installModuleIf(
                        SecurityConfig.class,
                        security -> "sql-standard".equalsIgnoreCase(security.getSecuritySystem()),
                        new SqlStandardSecurityModule()),
                binder -> {
                    MBeanServer platformMBeanServer = ManagementFactory.getPlatformMBeanServer();
                    binder.bind(MBeanServer.class).toInstance(new RebindSafeMBeanServer(platformMBeanServer));
                }
        );

        Injector injector = app
                .strictConfig()
                .doNotInitializeLogging()
                .setRequiredConfigurationProperties(config)
                .setOptionalConfigurationProperties(optionalConfig)
                .initialize();

        LifeCycleManager lifeCycleManager = injector.getInstance(LifeCycleManager.class);
        ConnectorMetadata metadata = injector.getInstance(ConnectorMetadata.class);
        ConnectorSplitManager splitManager = injector.getInstance(ConnectorSplitManager.class);
        ConnectorPageSourceProvider connectorPageSource = injector.getInstance(ConnectorPageSourceProvider.class);
        ConnectorPageSinkProvider pageSinkProvider = injector.getInstance(ConnectorPageSinkProvider.class);
        HiveSessionProperties hiveSessionProperties = injector.getInstance(HiveSessionProperties.class);
        HiveTableProperties hiveTableProperties = injector.getInstance(HiveTableProperties.class);
        ConnectorAccessControl accessControl = injector.getInstance(ConnectorAccessControl.class);

        return new HiveConnector(
                lifeCycleManager,
                new ClassLoaderSafeConnectorMetadata(metadata, classLoader),
                new ClassLoaderSafeConnectorSplitManager(splitManager, classLoader),
                new ClassLoaderSafeConnectorPageSourceProvider(connectorPageSource, classLoader),
                new ClassLoaderSafeConnectorPageSinkProvider(pageSinkProvider, classLoader),
                ImmutableSet.of(),
                hiveSessionProperties.getSessionProperties(),
                hiveTableProperties.getTableProperties(),
                accessControl);
    }
    catch (Exception e) {
        throw Throwables.propagate(e);
    }
}
 
开发者ID:y-lan,项目名称:presto,代码行数:61,代码来源:HiveConnectorFactory.java

示例9: testThreadPool

import org.weakref.jmx.guice.MBeanModule; //导入依赖的package包/类
@Test
public void testThreadPool() throws Exception
{
    Guice.createInjector(new AbstractModule() {
        @Override
        protected void configure()
        {
            install (new ThreadDelegatedScopeModule());
            install (ConfigModule.forTesting());
            install (new LifecycleModule());
            install (new NessThreadPoolModule("test"));

            install (new InstrumentationModule());

            bind (MBeanServer.class).toInstance(ManagementFactory.getPlatformMBeanServer());
            install (new MBeanModule());

            bind (Object.class).annotatedWith(Names.named("delegated")).toProvider(new Provider<Object>() {
                @Override
                public Object get()
                {
                    return new Object();
                }
            }).in(ThreadDelegatedScope.SCOPE);
        }
    }).injectMembers(this);

    lifecycle.executeTo(LifecycleStage.START_STAGE);

    final Thread currentThread = Thread.currentThread();

    final Object threadDelegatedObject = scopedProvider.get();

    Future<Boolean> future = service.submit(new Callable<Boolean>() {
        @Override
        public Boolean call()
        {
            assertTrue(threadDelegatedObject == scopedProvider.get());
            return currentThread == Thread.currentThread();
        }
    });

    assertFalse("must not be on same thread", future.get());

    lifecycle.executeTo(LifecycleStage.STOP_STAGE);
    assertTrue(service.isShutdown());
    assertTrue(service.isTerminated());
}
 
开发者ID:NessComputing,项目名称:components-ness-executors,代码行数:49,代码来源:LifecycleThreadPoolTest.java


注:本文中的org.weakref.jmx.guice.MBeanModule类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。