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


Java DiscoveryModule类代码示例

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


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

示例1: main

import io.airlift.discovery.client.DiscoveryModule; //导入依赖的package包/类
public static void main(String[] args)
        throws Exception
{
    if (System.getProperty("config", null) == null) {
        System.setProperty("config", "etc/agent.properties");
    }

    Bootstrap bootstrap = new Bootstrap(
            new NodeModule(),
            new DiscoveryModule(),
            new HttpServerModule(),
            new JsonModule(),
            new JaxrsModule(true), // requireExplicitBindings = true
            new HttpEventModule(),
            new JsonReaderModule(false),
            new DynamicAnnouncementModule(),
            new AgentServerModule()
    );

    try {
        Injector injector = bootstrap.strictConfig().initialize();
        injector.getInstance(Announcer.class).start();
    }
    catch (Exception e) {
        LOG.error(e, "Error starting server");
    }
}
 
开发者ID:prestodb,项目名称:presto-manager,代码行数:28,代码来源:AgentServer.java

示例2: main

import io.airlift.discovery.client.DiscoveryModule; //导入依赖的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: TestingDiscoveryServer

import io.airlift.discovery.client.DiscoveryModule; //导入依赖的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

示例4: run

import io.airlift.discovery.client.DiscoveryModule; //导入依赖的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


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