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