• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ServerFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: configure

import io.dropwizard.server.ServerFactory; //导入依赖的package包/类
@Override
protected void configure() {
    install(new SettingsModule());
    bind(Environment.class).toInstance(_environment);
    bind(HealthCheckRegistry.class).to(DropwizardHealthCheckRegistry.class).asEagerSingleton();
    bind(LifeCycleRegistry.class).to(DropwizardLifeCycleRegistry.class).asEagerSingleton();
    bind(ZooKeeperConfiguration.class).toInstance(_configuration.getZooKeeperConfiguration());
    bind(String.class).annotatedWith(ServerCluster.class).toInstance(_configuration.getCluster());
    bind(MetricRegistry.class).toInstance(_environment.metrics());
    bind(ServerFactory.class).toInstance(_configuration.getServerFactory());
    bind(DataCenterConfiguration.class).toInstance(_configuration.getDataCenterConfiguration());
    bind(CqlDriverConfiguration.class).toInstance(_configuration.getCqlDriverConfiguration());
    bind(Clock.class).toInstance(Clock.systemUTC());
}
 
开发者ID:bazaarvoice,项目名称:emodb,代码行数:15,代码来源:EmoModule.java


示例2: updatePortsToAvoidCollision

import io.dropwizard.server.ServerFactory; //导入依赖的package包/类
private static void updatePortsToAvoidCollision(ServerFactory serverFactory) {
    if (serverFactory instanceof DefaultServerFactory) {
        DefaultServerFactory defaultServerFactory = (DefaultServerFactory)serverFactory;
        updatePortsToAvoidCollision(defaultServerFactory.getApplicationConnectors());
        updatePortsToAvoidCollision(defaultServerFactory.getAdminConnectors());
    } else if (serverFactory instanceof SimpleServerFactory) {
        SimpleServerFactory simpleServerFactory = (SimpleServerFactory)serverFactory;
        updatePortsToAvoidCollision(Collections.singleton(simpleServerFactory.getConnector()));
    } else {
        throw new IllegalStateException("Encountered an unexpected ServerFactory type");
    }
}
 
开发者ID:bazaarvoice,项目名称:emodb,代码行数:13,代码来源:ScanUploadTest.java


示例3: provideSelfHostAndPort

import io.dropwizard.server.ServerFactory; //导入依赖的package包/类
@Provides @Singleton @SelfHostAndPort
public HostAndPort provideSelfHostAndPort(ServerFactory serverFactory) {
    // Our method for obtaining connector factories from the server factory varies depending on the latter's type
    List<ConnectorFactory> appConnectorFactories;
    if (serverFactory instanceof DefaultServerFactory) {
        appConnectorFactories = ((DefaultServerFactory) serverFactory).getApplicationConnectors();
    } else if (serverFactory instanceof SimpleServerFactory) {
        appConnectorFactories = Collections.singletonList(((SimpleServerFactory) serverFactory).getConnector());
    } else {
        throw new IllegalStateException("Encountered an unexpected ServerFactory type");
    }

    return getHostAndPortFromConnectorFactories(appConnectorFactories);
}
 
开发者ID:bazaarvoice,项目名称:emodb,代码行数:15,代码来源:SelfHostAndPortModule.java


示例4: provideSelfAdminHostAndPort

import io.dropwizard.server.ServerFactory; //导入依赖的package包/类
@Provides @Singleton @SelfAdminHostAndPort
public HostAndPort provideSelfAdminHostAndPort(ServerFactory serverFactory) {
    // Our method for obtaining connector factories from the server factory varies depending on the latter's type
    List<ConnectorFactory> adminConnectorFactories;
    if (serverFactory instanceof DefaultServerFactory) {
        adminConnectorFactories = ((DefaultServerFactory) serverFactory).getAdminConnectors();
    } else if (serverFactory instanceof SimpleServerFactory) {
        adminConnectorFactories = Collections.singletonList(((SimpleServerFactory) serverFactory).getConnector());
    } else {
        throw new IllegalStateException("Encountered an unexpected ServerFactory type");
    }

    return getHostAndPortFromConnectorFactories(adminConnectorFactories);
}
 
开发者ID:bazaarvoice,项目名称:emodb,代码行数:15,代码来源:SelfHostAndPortModule.java


示例5: start

import io.dropwizard.server.ServerFactory; //导入依赖的package包/类
@Override
public void start() throws Exception {
   EurekaClientConfiguration eurekaClientConfiguration = configuration.getEureka();
   ServerFactory serverFactory = configuration.getServerFactory();

   BaseConfiguration baseConfiguration = new BaseConfiguration();
   baseConfiguration.setProperty(eurekaNamespace + "name", eurekaClientConfiguration.getName());
   baseConfiguration.setProperty(eurekaNamespace + "vipAddress", eurekaClientConfiguration.getVipAddress());
   baseConfiguration.setProperty(eurekaNamespace + "serviceUrl.default", eurekaClientConfiguration.getDefaultServiceUrl());
   baseConfiguration.setProperty(eurekaNamespace + "port", eurekaClientConfiguration.getPort());

   Integer port = DropwizardServerHelpers.getPort(serverFactory);
   Integer adminPort = DropwizardServerHelpers.getAdminPort(serverFactory);

   baseConfiguration.setProperty(eurekaNamespace + "healthCheckUrl", String.format("http://${eureka.hostname}:%d/healthcheck", adminPort));
   baseConfiguration.setProperty(eurekaNamespace + "secureHealthCheckUrl", String.format("http://${eureka.hostname}:%d/healthcheck", adminPort));
   baseConfiguration.setProperty(eurekaNamespace + "statusPageUrl", String.format("http://${eureka.hostname}:%d/healthcheck", adminPort));
   ConfigurationManager.loadPropertiesFromConfiguration(baseConfiguration);

   EurekaInstanceConfig eurekaInstanceConfig = createEurekaInstanceConfig(discoveryMetadataProviders);

   DiscoveryManager.getInstance().initComponent(eurekaInstanceConfig, new DefaultEurekaClientConfig(eurekaNamespace));

   DiscoveryManager.getInstance().getDiscoveryClient().registerHealthCheckCallback(healthCheck);

   markAsUp();
}
 
开发者ID:guggens,项目名称:log-dropwizard-eureka-mongo-sample,代码行数:28,代码来源:EurekaInstance.java


示例6: getPort

import io.dropwizard.server.ServerFactory; //导入依赖的package包/类
public static Integer getPort(ServerFactory serverFactory) {
   if(serverFactory instanceof SimpleServerFactory) {
      return getPort(((SimpleServerFactory)serverFactory).getConnector());
   }
   else if(serverFactory instanceof DefaultServerFactory) {
      return getPort(((DefaultServerFactory)serverFactory).getApplicationConnectors().get(0));
   }
   throw new RuntimeException("Unable to infer Port of " + serverFactory);
}
 
开发者ID:guggens,项目名称:log-dropwizard-eureka-mongo-sample,代码行数:10,代码来源:DropwizardServerHelpers.java


示例7: getAdminPort

import io.dropwizard.server.ServerFactory; //导入依赖的package包/类
public static Integer getAdminPort(ServerFactory serverFactory) {
   if(serverFactory instanceof SimpleServerFactory) {
      return getPort(((SimpleServerFactory)serverFactory).getConnector());
   }
   else if(serverFactory instanceof DefaultServerFactory) {
      return getPort(((DefaultServerFactory)serverFactory).getAdminConnectors().get(0));
   }
   throw new RuntimeException("Unable to infer AdminPort of " + serverFactory);
}
 
开发者ID:guggens,项目名称:log-dropwizard-eureka-mongo-sample,代码行数:10,代码来源:DropwizardServerHelpers.java


示例8: getConnectorFactoy

import io.dropwizard.server.ServerFactory; //导入依赖的package包/类
private @Nonnull HttpConnectorFactory getConnectorFactoy(ServerFactory serverFactory) {
	if(serverFactory instanceof DefaultServerFactory) {
		return getDefaultServerFactory(serverFactory);
	} else if(serverFactory instanceof SimpleServerFactory) {
		return getSimpleServerFactory(serverFactory);
	}
	throw new IllegalArgumentException(
			String.format("Unknonw ServerFactory instance '%s'", serverFactory.getClass().getName()));
}
 
开发者ID:rrauschenbach,项目名称:FeedExpander,代码行数:10,代码来源:ExpanderApplication.java


示例9: getSimpleServerFactory

import io.dropwizard.server.ServerFactory; //导入依赖的package包/类
private @Nonnull HttpConnectorFactory getSimpleServerFactory(ServerFactory serverFactory) {
	HttpConnectorFactory connector = (HttpConnectorFactory) ((SimpleServerFactory)serverFactory).getConnector();
	if (connector.getClass().isAssignableFrom(HttpConnectorFactory.class)) {
	    return connector;
	}
	throw new IllegalArgumentException(String.format("Failed to find any server ConnectorFactory in serverFactory '%s'",
			serverFactory.getClass().getName()));		
}
 
开发者ID:rrauschenbach,项目名称:FeedExpander,代码行数:9,代码来源:ExpanderApplication.java


示例10: getDefaultServerFactory

import io.dropwizard.server.ServerFactory; //导入依赖的package包/类
private @Nonnull HttpConnectorFactory getDefaultServerFactory(ServerFactory serverFactory) {
	for (ConnectorFactory connector : ((DefaultServerFactory)serverFactory).getApplicationConnectors()) {
		if (connector.getClass().isAssignableFrom(HttpConnectorFactory.class)) {
			return (HttpConnectorFactory) connector;
		}
	}
	throw new IllegalArgumentException(String.format("Failed to find any server ConnectorFactory in serverFactory '%s'",
			serverFactory.getClass().getName()));
}
 
开发者ID:rrauschenbach,项目名称:FeedExpander,代码行数:10,代码来源:ExpanderApplication.java


示例11: EmbeddedOrientServer

import io.dropwizard.server.ServerFactory; //导入依赖的package包/类
/**
 * @param conf          orient server configuration object
 * @param mapper        for serializing orient security json from yaml configuration
 * @param serverFactory dropwizard connectors configuration
 */
public EmbeddedOrientServer(final OrientServerConfiguration conf, final ObjectMapper mapper,
                            final ServerFactory serverFactory) {
    this.conf = validateConfiguration(conf);
    this.mapper = mapper;
    this.dwServer = serverFactory;
}
 
开发者ID:xvik,项目名称:dropwizard-orient-server,代码行数:12,代码来源:EmbeddedOrientServer.java


示例12: configureHystrix

import io.dropwizard.server.ServerFactory; //导入依赖的package包/类
protected void configureHystrix(T configuration, Environment environment) {
    final ServerFactory serverFactory = configuration.getServerFactory();
    final Duration shutdownGracePeriod =
            (serverFactory instanceof AbstractServerFactory)
            ? ((AbstractServerFactory) serverFactory).getShutdownGracePeriod()
            : Duration.seconds(30L);
    environment.lifecycle().manage(new ManagedHystrix(shutdownGracePeriod));
}
 
开发者ID:yammer,项目名称:tenacity,代码行数:9,代码来源:TenacityConfiguredBundle.java


示例13: setup

import io.dropwizard.server.ServerFactory; //导入依赖的package包/类
@BeforeClass
public void setup() throws Exception {
    _lifeCycle = new SimpleLifeCycleRegistry();
    _healthChecks = mock(HealthCheckRegistry.class);

    // Start test instance of ZooKeeper in the current JVM
    TestingServer testingServer = new TestingServer();
    _lifeCycle.manage(testingServer);

    // Connect to ZooKeeper
    final CuratorFramework curator = CuratorFrameworkFactory.newClient(testingServer.getConnectString(),
            new BoundedExponentialBackoffRetry(100, 1000, 5));
    _lifeCycle.manage(curator).start();

    // Setup the DataStoreModule
    Injector injector = Guice.createInjector(new AbstractModule() {
        @Override
        protected void configure() {
            bind(LifeCycleRegistry.class).toInstance(_lifeCycle);
            bind(HealthCheckRegistry.class).toInstance(_healthChecks);
            bind(TaskRegistry.class).toInstance(mock(TaskRegistry.class));

            bind(DataStoreConfiguration.class).toInstance(new DataStoreConfiguration()
                    .setSystemTablePlacement("app_global:sys")
                    .setValidTablePlacements(ImmutableSet.of("app_global:sys", "ugc_global:ugc"))
                    .setCassandraClusters(ImmutableMap.<String, CassandraConfiguration>of(
                            "ugc_global", new TestCassandraConfiguration("ugc_global", "ugc_delta"),
                            "app_global", new TestCassandraConfiguration("app_global", "sys_delta")))
                    .setHistoryTtl(Period.days(2)));
            bind(DataStore.class).annotatedWith(SystemDataStore.class).toInstance(mock(DataStore.class));
            bind(JobService.class).toInstance(mock(JobService.class));
            bind(JobHandlerRegistry.class).toInstance(mock(JobHandlerRegistry.class));

            bind(DataCenterConfiguration.class).toInstance(new DataCenterConfiguration()
                    .setCurrentDataCenter("datacenter1")
                    .setSystemDataCenter("datacenter1")
                    .setDataCenterServiceUri(URI.create("http://localhost:8080"))
                    .setDataCenterAdminUri(URI.create("http://localhost:8080")));

            bind(CqlDriverConfiguration.class).toInstance(new CqlDriverConfiguration());

            bind(KeyspaceDiscovery.class).annotatedWith(Names.named("blob")).toInstance(mock(KeyspaceDiscovery.class));
            bind(String.class).annotatedWith(ServerCluster.class).toInstance("local_default");

            bind(String.class).annotatedWith(ReplicationKey.class).toInstance("password");
            bind(String.class).annotatedWith(InvalidationService.class).toInstance("emodb-cachemgr");

            bind(CuratorFramework.class).annotatedWith(Global.class).toInstance(curator);
            bind(CuratorFramework.class).annotatedWith(DataStoreZooKeeper.class)
                    .toInstance(ZKNamespaces.usingChildNamespace(curator, "applications/emodb-sor"));
            bind(CuratorFramework.class).annotatedWith(GlobalFullConsistencyZooKeeper.class)
                    .toInstance(ZKNamespaces.usingChildNamespace(curator, "applications/emodb-fct"));

            bind(new TypeLiteral<Supplier<Boolean>>(){}).annotatedWith(CqlForScans.class)
                    .toInstance(Suppliers.ofInstance(true));
            bind(new TypeLiteral<Supplier<Boolean>>(){}).annotatedWith(CqlForMultiGets.class)
                    .toInstance(Suppliers.ofInstance(true));

            bind(ServerFactory.class).toInstance(new SimpleServerFactory());

            bind(ServiceRegistry.class).toInstance(mock(ServiceRegistry.class));

            bind(Clock.class).toInstance(Clock.systemDefaultZone());

            EmoServiceMode serviceMode = EmoServiceMode.STANDARD_ALL;
            install(new SelfHostAndPortModule());
            install(new DataCenterModule(serviceMode));
            install(new CacheManagerModule());
            install(new DataStoreModule(serviceMode));
        }
    });
    _store = injector.getInstance(DataStore.class);
    _lifeCycle.start();

    Map<String, Object> template = Collections.emptyMap();
    _store.createTable(TABLE, new TableOptionsBuilder().setPlacement("ugc_global:ugc").build(), template, newAudit("create table"));
}
 
开发者ID:bazaarvoice,项目名称:emodb,代码行数:78,代码来源:CasDataStoreTest.java


示例14: run

import io.dropwizard.server.ServerFactory; //导入依赖的package包/类
public void run(T configuration, Environment environment) {
    handler = determineHandler(configuration, environment);
    ServerFactory serverFactory = configuration.getServerFactory();
    ServerFactoryWrapper factoryWrapper = new ServerFactoryWrapper(serverFactory, handler);
    configuration.setServerFactory(factoryWrapper);
}
 
开发者ID:TomCools,项目名称:dropwizard-websocket-jee7-bundle,代码行数:7,代码来源:WebsocketBundle.java


示例15: ServerFactoryWrapper

import io.dropwizard.server.ServerFactory; //导入依赖的package包/类
public ServerFactoryWrapper(ServerFactory serverFactory, WebsocketHandler handler) {
    this.serverFactory = serverFactory;
    this.handler = handler;
}
 
开发者ID:TomCools,项目名称:dropwizard-websocket-jee7-bundle,代码行数:5,代码来源:ServerFactoryWrapper.java


示例16: AutoSslConfigurator

import io.dropwizard.server.ServerFactory; //导入依赖的package包/类
public AutoSslConfigurator(final ServerFactory dwServer, final OServerConfiguration conf) {
    this.dwServer = dwServer;
    this.conf = conf;
}
 
开发者ID:xvik,项目名称:dropwizard-orient-server,代码行数:5,代码来源:AutoSslConfigurator.java


示例17: getServerFactory

import io.dropwizard.server.ServerFactory; //导入依赖的package包/类
@Override
@JsonProperty("server")
@Value.Default
public ServerFactory getServerFactory() {
  return new DefaultServerFactory();
}
 
开发者ID:HuygensING,项目名称:timbuctoo,代码行数:7,代码来源:TimbuctooConfiguration.java


示例18: getServerFactory

import io.dropwizard.server.ServerFactory; //导入依赖的package包/类
ServerFactory getServerFactory(); 
开发者ID:guggens,项目名称:log-dropwizard-eureka-mongo-sample,代码行数:2,代码来源:ConfiguresEurekaClient.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ClientMetrics类代码示例发布时间:2022-05-23
下一篇:
Java EmbeddedDatabaseFactoryBean类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap