當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。