本文整理汇总了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");
}
}
示例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");
}
}
示例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);
}
示例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);
}
}