Interface DiscoveryStrategyFactory
-
- All Known Implementing Classes:
AwsDiscoveryStrategyFactory
,AzureDiscoveryStrategyFactory
,GcpDiscoveryStrategyFactory
,HazelcastKubernetesDiscoveryStrategyFactory
,MulticastDiscoveryStrategyFactory
public interface DiscoveryStrategyFactory
TheDiscoveryStrategyFactory
is the entry point for strategy vendors. EveryDiscoveryStrategy
should have its own factory building it. In rare cases (like multiple version support or similar) one factory might return different provider implementations based on certain criteria. It is also up to theDiscoveryStrategyFactory
to cache instances and return them in some kind of a Singleton-like fashion.The defined set of configuration properties describes the existing properties inside of the Hazelcast configuration. It will be used for automatic conversion, type-checking and validation before handing them to the
DiscoveryStrategy
. This removes a lot of boilerplate from the provider vendor and provides some convenience as well as guarantee to execute the expected configuration checks. The later is especially important because there is no schema support for properties necessary or provided by the provider plugins. Any kind of violation while verification of any type conversion error as well as missing non-optional properties will throw an exception and prevent the node from starting up.- Since:
- 3.6
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
DiscoveryStrategyFactory.DiscoveryStrategyLevel
Level of the discovery strategy.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default DiscoveryStrategyFactory.DiscoveryStrategyLevel
discoveryStrategyLevel()
Level of the discovery strategy.java.util.Collection<PropertyDefinition>
getConfigurationProperties()
Returns a set of the expected configuration properties.java.lang.Class<? extends DiscoveryStrategy>
getDiscoveryStrategyType()
Returns the type of theDiscoveryStrategy
itself.default boolean
isAutoDetectionApplicable()
Checks whether the given discovery strategy may be applied with no additional config to the environment in which Hazelcast is currently running.DiscoveryStrategy
newDiscoveryStrategy(DiscoveryNode discoveryNode, ILogger logger, java.util.Map<java.lang.String,java.lang.Comparable> properties)
Instantiates a new instance of theDiscoveryStrategy
with the given configuration properties.
-
-
-
Method Detail
-
getDiscoveryStrategyType
java.lang.Class<? extends DiscoveryStrategy> getDiscoveryStrategyType()
Returns the type of theDiscoveryStrategy
itself.- Returns:
- the type of the discovery strategy
-
newDiscoveryStrategy
DiscoveryStrategy newDiscoveryStrategy(DiscoveryNode discoveryNode, ILogger logger, java.util.Map<java.lang.String,java.lang.Comparable> properties)
Instantiates a new instance of theDiscoveryStrategy
with the given configuration properties. The providedHazelcastInstance
can be used to register instances in a service registry whenever the discovery strategy is started.- Parameters:
discoveryNode
- the current localDiscoveryNode
, representing the local connection information if running on a Hazelcast member, otherwise on Hazelcast clients alwaysnull
logger
- the logger instanceproperties
- the properties parsed from the configuration- Returns:
- a new instance of the discovery strategy
-
getConfigurationProperties
java.util.Collection<PropertyDefinition> getConfigurationProperties()
Returns a set of the expected configuration properties. These properties contain information about the value type of the property, if it is required and a possible validator to automatically test and convert values from the XML configuration.- Returns:
- a set of expected configuration properties
-
isAutoDetectionApplicable
default boolean isAutoDetectionApplicable()
Checks whether the given discovery strategy may be applied with no additional config to the environment in which Hazelcast is currently running.Used by the auto detection mechanism to decide which strategy should be used.
-
discoveryStrategyLevel
default DiscoveryStrategyFactory.DiscoveryStrategyLevel discoveryStrategyLevel()
Level of the discovery strategy.
-
-