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


Java DiscoveryStrategy类代码示例

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


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

示例1: discoveryStrategyFactory

import com.hazelcast.spi.discovery.DiscoveryStrategy; //导入依赖的package包/类
@Bean
public DiscoveryStrategyFactory discoveryStrategyFactory () {
    return new DiscoveryStrategyFactory() {

        @Override
        public Class<? extends DiscoveryStrategy> getDiscoveryStrategyType () {
            return EurekaDiscoveryStrategy.class;
        }

        @Override
        public DiscoveryStrategy newDiscoveryStrategy (DiscoveryNode discoveryNode,
                                                       ILogger logger,
                                                       Map<String, Comparable> properties
        ) {
            val eurekaDiscoveryStrategy = new EurekaDiscoveryStrategy(logger, emptyMap());
            eurekaDiscoveryStrategy.setDiscoveryClient(discoveryClient);
            eurekaDiscoveryStrategy.setHaselcastNodeServiceId(applicationName);
            return eurekaDiscoveryStrategy;
        }

        @Override
        public Collection<PropertyDefinition> getConfigurationProperties () {
            return null;
        }
    };
}
 
开发者ID:xxlabaza,项目名称:hazelcast_eureka,代码行数:27,代码来源:HazelcastMemberConfiguration.java

示例2: discoveryProviderTest

import com.hazelcast.spi.discovery.DiscoveryStrategy; //导入依赖的package包/类
@Test
public void discoveryProviderTest() throws Exception {
  environmentVariables.set("HEROKU_DNS_FORMATION_NAME", "localhost");

  DiscoveryNode local = new SimpleDiscoveryNode(new Address("127.0.0.1", 1010));
  DiscoveryStrategyFactory factory = new HerokuDiscoveryStrategyFactory();
  DiscoveryStrategy provider = factory.newDiscoveryStrategy(local, null, new HashMap<>());

  provider.start();

  Iterable<DiscoveryNode> nodes = provider.discoverNodes();
  Assert.assertNotNull(nodes);
  Assert.assertTrue("Empty DiscoveryNode list", nodes.iterator().hasNext());

  for (DiscoveryNode node : nodes) {
    LOGGER.info("Node -> {}", node.getPublicAddress());
  }
}
 
开发者ID:jkutner,项目名称:hazelcast-heroku-discovery,代码行数:19,代码来源:HerokuDiscoveryTest.java

示例3: discoveryStrategyFactoryTest

import com.hazelcast.spi.discovery.DiscoveryStrategy; //导入依赖的package包/类
@Test
public void discoveryStrategyFactoryTest() {
    JCloudsDiscoveryStrategyFactory jCloudsDiscoveryStrategyFactory = new JCloudsDiscoveryStrategyFactory();
    String xmlFileName = "test-jclouds-config.xml";
    InputStream xmlResource = JCloudsDiscoveryFactoryTest.class.getClassLoader().getResourceAsStream(xmlFileName);
    Config config = new XmlConfigBuilder(xmlResource).build();

    JoinConfig joinConfig = config.getNetworkConfig().getJoin();
    DiscoveryConfig discoveryConfig = joinConfig.getDiscoveryConfig();
    DiscoveryStrategyConfig providerConfig = discoveryConfig.getDiscoveryStrategyConfigs().iterator().next();

    assertEquals(jCloudsDiscoveryStrategyFactory.getDiscoveryStrategyType(), JCloudsDiscoveryStrategy.class);
    assertEquals(JCloudsDiscoveryStrategy.class.getName(), providerConfig.getClassName());
    assertEquals(jCloudsDiscoveryStrategyFactory.getConfigurationProperties().size(), providerConfig.getProperties().size());
    assertTrue(jCloudsDiscoveryStrategyFactory.
            newDiscoveryStrategy(null, null, new HashMap<String, Comparable>()) instanceof DiscoveryStrategy);
}
 
开发者ID:hazelcast,项目名称:hazelcast-jclouds,代码行数:18,代码来源:JCloudsDiscoveryFactoryTest.java

示例4: validateConfig

import com.hazelcast.spi.discovery.DiscoveryStrategy; //导入依赖的package包/类
private void validateConfig(final Config config){
    final DiscoveryConfig discoveryConfig = config.getNetworkConfig().getJoin().getDiscoveryConfig();
    final DiscoveryServiceSettings settings = new DiscoveryServiceSettings().setDiscoveryConfig(discoveryConfig);
    final DefaultDiscoveryService service = new DefaultDiscoveryService(settings);
    final Iterator<DiscoveryStrategy> strategies = service.getDiscoveryStrategies().iterator();

    assertTrue(strategies.hasNext());
    final DiscoveryStrategy strategy = strategies.next();
    assertTrue(strategy != null && strategy instanceof AwsDiscoveryStrategy);
}
 
开发者ID:hazelcast,项目名称:hazelcast-aws,代码行数:11,代码来源:AwsDiscoveryStrategyFactoryTest.java

示例5: newDiscoveryStrategy

import com.hazelcast.spi.discovery.DiscoveryStrategy; //导入依赖的package包/类
public DiscoveryStrategy newDiscoveryStrategy(DiscoveryNode discoveryNode, ILogger logger,
                                              Map<String, Comparable> properties) {
    EurekaOneDiscoveryStrategyBuilder builder = new EurekaOneDiscoveryStrategyBuilder();
    builder.setDiscoveryNode(discoveryNode).setILogger(logger).setProperties(properties)
            .setEurekaClient(eurekaClient);
    return builder.build();
}
 
开发者ID:hazelcast,项目名称:hazelcast-eureka,代码行数:8,代码来源:EurekaOneDiscoveryStrategyFactory.java

示例6: createDiscoveryStrategy

import com.hazelcast.spi.discovery.DiscoveryStrategy; //导入依赖的package包/类
@Test
public void createDiscoveryStrategy() {
    HashMap<String, Comparable> properties = new HashMap<String, Comparable>();
    properties.put(KubernetesProperties.KUBERNETES_API_TOKEN.key(), API_TOKEN);
    properties.put(String.valueOf(KubernetesProperties.SERVICE_PORT), 333);
    HazelcastKubernetesDiscoveryStrategyFactory factory = new HazelcastKubernetesDiscoveryStrategyFactory();
    DiscoveryStrategy strategy   = factory.newDiscoveryStrategy(discoveryNode, LOGGER, properties);
    assertTrue(strategy instanceof  HazelcastKubernetesDiscoveryStrategy);
    strategy.start();
    strategy.destroy();
}
 
开发者ID:hazelcast,项目名称:hazelcast-kubernetes,代码行数:12,代码来源:KubernetesDiscoveryStrategyFactoryTest.java

示例7: newDiscoveryStrategy

import com.hazelcast.spi.discovery.DiscoveryStrategy; //导入依赖的package包/类
@Override
public DiscoveryStrategy newDiscoveryStrategy(DiscoveryNode discoveryNode, ILogger logger,
        @SuppressWarnings("rawtypes") Map<String, Comparable> properties) {
    discovery.setSelfNode(discoveryNode);
    try {
        discovery.checkin();
    } catch (Exception e) {
        throw new IllegalStateException(e);
    }
    return discovery;
}
 
开发者ID:rancher,项目名称:cattle,代码行数:12,代码来源:DBDiscoveryFactory.java

示例8: getDiscoveryStrategyType

import com.hazelcast.spi.discovery.DiscoveryStrategy; //导入依赖的package包/类
public Class<? extends DiscoveryStrategy> getDiscoveryStrategyType() {
	// Returns the actual class type of the DiscoveryStrategy
	// implementation, to match it against the configuration
	return DockerSwarmDiscoveryStrategy.class;
}
 
开发者ID:bitsofinfo,项目名称:hazelcast-docker-swarm-discovery-spi,代码行数:6,代码来源:DockerSwarmDiscoveryStrategyFactory.java

示例9: newDiscoveryStrategy

import com.hazelcast.spi.discovery.DiscoveryStrategy; //导入依赖的package包/类
public DiscoveryStrategy newDiscoveryStrategy(DiscoveryNode discoveryNode,
											  ILogger logger,
											  Map<String, Comparable> properties ) {

	return new DockerSwarmDiscoveryStrategy( discoveryNode, logger, properties );                                      
}
 
开发者ID:bitsofinfo,项目名称:hazelcast-docker-swarm-discovery-spi,代码行数:7,代码来源:DockerSwarmDiscoveryStrategyFactory.java

示例10: getDiscoveryStrategyType

import com.hazelcast.spi.discovery.DiscoveryStrategy; //导入依赖的package包/类
public Class<? extends DiscoveryStrategy> getDiscoveryStrategyType() {
    return ZookeeperDiscoveryStrategy.class;
}
 
开发者ID:hazelcast,项目名称:hazelcast-zookeeper,代码行数:4,代码来源:ZookeeperDiscoveryStrategyFactory.java

示例11: newDiscoveryStrategy

import com.hazelcast.spi.discovery.DiscoveryStrategy; //导入依赖的package包/类
public DiscoveryStrategy newDiscoveryStrategy(DiscoveryNode discoveryNode, ILogger logger,
                                              Map<String, Comparable> properties) {
    return new ZookeeperDiscoveryStrategy(discoveryNode, logger, properties);
}
 
开发者ID:hazelcast,项目名称:hazelcast-zookeeper,代码行数:5,代码来源:ZookeeperDiscoveryStrategyFactory.java

示例12: getDiscoveryStrategyType

import com.hazelcast.spi.discovery.DiscoveryStrategy; //导入依赖的package包/类
@Override
public Class<? extends DiscoveryStrategy> getDiscoveryStrategyType() {
    return SomeRestServiceDiscoveryStrategy.class;
}
 
开发者ID:noctarius,项目名称:hazelcast-discovery-spi-demonstration,代码行数:5,代码来源:SomeRestServiceDiscoveryStrategyFactory.java

示例13: newDiscoveryStrategy

import com.hazelcast.spi.discovery.DiscoveryStrategy; //导入依赖的package包/类
@Override
public DiscoveryStrategy newDiscoveryStrategy(DiscoveryNode discoveryNode, ILogger logger,
                                              Map<String, Comparable> properties) {

    return new SomeRestServiceDiscoveryStrategy(discoveryNode, logger, properties);
}
 
开发者ID:noctarius,项目名称:hazelcast-discovery-spi-demonstration,代码行数:7,代码来源:SomeRestServiceDiscoveryStrategyFactory.java

示例14: getDiscoveryStrategyType

import com.hazelcast.spi.discovery.DiscoveryStrategy; //导入依赖的package包/类
@Override
public Class<? extends DiscoveryStrategy> getDiscoveryStrategyType() {
    return AwsDiscoveryStrategy.class;
}
 
开发者ID:hazelcast,项目名称:hazelcast-aws,代码行数:5,代码来源:AwsDiscoveryStrategyFactory.java

示例15: newDiscoveryStrategy

import com.hazelcast.spi.discovery.DiscoveryStrategy; //导入依赖的package包/类
@Override
public DiscoveryStrategy newDiscoveryStrategy(DiscoveryNode discoveryNode,
                                              ILogger logger,
                                              Map<String, Comparable> properties) {
    return new AwsDiscoveryStrategy(properties);
}
 
开发者ID:hazelcast,项目名称:hazelcast-aws,代码行数:7,代码来源:AwsDiscoveryStrategyFactory.java


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