public class AzureDiscoveryStrategyFactory extends Object implements DiscoveryStrategyFactory
AzureDiscoveryStrategy to Discovery SPIDiscoveryStrategyFactory.DiscoveryStrategyLevel| Constructor and Description | 
|---|
| AzureDiscoveryStrategyFactory() | 
| Modifier and Type | Method and Description | 
|---|---|
| DiscoveryStrategyFactory.DiscoveryStrategyLevel | discoveryStrategyLevel()Level of the discovery strategy. | 
| Collection<PropertyDefinition> | getConfigurationProperties()Returns a set of the expected configuration properties. | 
| Class<? extends DiscoveryStrategy> | getDiscoveryStrategyType()Returns the type of the  DiscoveryStrategyitself. | 
| boolean | isAutoDetectionApplicable()Checks if Hazelcast is running on Azure. | 
| DiscoveryStrategy | newDiscoveryStrategy(DiscoveryNode node,
                    ILogger logger,
                    Map<String,Comparable> properties)Instantiates a new instance of the  DiscoveryStrategywith the given configuration
 properties. | 
public Class<? extends DiscoveryStrategy> getDiscoveryStrategyType()
DiscoveryStrategyFactoryDiscoveryStrategy itself.getDiscoveryStrategyType in interface DiscoveryStrategyFactorypublic DiscoveryStrategy newDiscoveryStrategy(DiscoveryNode node, ILogger logger, Map<String,Comparable> properties)
DiscoveryStrategyFactoryDiscoveryStrategy with the given configuration
 properties. The provided HazelcastInstance can be used to register instances in
 a service registry whenever the discovery strategy is started.newDiscoveryStrategy in interface DiscoveryStrategyFactorynode - the current local DiscoveryNode, representing the local
                      connection information if running on a Hazelcast member, otherwise on
                      Hazelcast clients always nulllogger - the logger instanceproperties - the properties parsed from the configurationpublic Collection<PropertyDefinition> getConfigurationProperties()
DiscoveryStrategyFactorygetConfigurationProperties in interface DiscoveryStrategyFactorypublic boolean isAutoDetectionApplicable()
To check if Hazelcast is running on Azure, we first check whether "internal.cloudapp.net" is present in the file "/etc/resolv.conf". Such an approach is not officially documented but seems like a good enough heuristic to detect an Azure Compute VM Instance. Since it's not the official method, we still need to make an API call to a local, non-routable address http://169.254.169.254/metadata/instance.
isAutoDetectionApplicable in interface DiscoveryStrategyFactorypublic DiscoveryStrategyFactory.DiscoveryStrategyLevel discoveryStrategyLevel()
DiscoveryStrategyFactorydiscoveryStrategyLevel in interface DiscoveryStrategyFactoryCopyright © 2022 Hazelcast, Inc.. All rights reserved.