Interface DiscoveryStrategy
- All Known Implementing Classes:
- AbstractDiscoveryStrategy,- AwsDiscoveryStrategy,- AzureDiscoveryStrategy,- GcpDiscoveryStrategy,- MulticastDiscoveryStrategy
DiscoveryStrategy itself is the actual implementation to discover
 nodes based on whatever environment is used to run the Hazelcast cloud. The
 internal implementation is completely vendor specific and might use external Java
 libraries to query APIs or send requests to a external REST service.
 
 DiscoveryStrategies are also free to define any kind of properties that might
 be necessary to discover eligible nodes based on configured attributes, tags or any
 other kind of metadata.
 
Using the simple lifecycle management strategies like multicast discovery is able to register and destroy sockets based on Hazelcast’s lifecycle. Deactivated services will also never be started.
 Attention: Instead of implementing this interface directly, implementors should consider
 using the abstract class AbstractDiscoveryStrategy instead for easier upgradeability
 while this interface evolves.
- Since:
- 3.6
- 
Method SummaryModifier and TypeMethodDescriptionvoiddestroy()Thestopmethod is used to stop internal services, sockets or to destroy any kind of internal state.Returns a map with discovered metadata provided by the runtime environment.Returns a set of all discovered nodes based on the defined properties that were used to create theDiscoveryStrategyinstance.default PartitionGroupStrategyDeprecated.default PartitionGroupStrategygetPartitionGroupStrategy(Collection<? extends Member> allMembers) Returns a custom implementation of aPartitionGroupStrategyto override default behavior of zone aware backup strategiesPartitionGroupMetaDataor to provide a specific behavior in case the discovery environment does not provide information about the infrastructure to be used for automatic configuration.Fetches a set ofAddressmarked as unhealthy by the underlying implementation.default voidmarkEndpointAsUnhealthy(Address address) Marks the passedAddressas unhealthy, which prevents it from being offered as a viable endpoint in someDiscoveryStrategyimplementations, usually prompting this endpoint to be periodically probed for liveliness.voidstart()Thestartmethod is used to initialize internal state and perform any kind of startup procedure like multicast socket creation.
- 
Method Details- 
startvoid start()Thestartmethod is used to initialize internal state and perform any kind of startup procedure like multicast socket creation. The behavior of this method might change based on theDiscoveryNodeinstance passed to theDiscoveryStrategyFactory.
- 
discoverNodesIterable<DiscoveryNode> discoverNodes()Returns a set of all discovered nodes based on the defined properties that were used to create theDiscoveryStrategyinstance.- Returns:
- a set of all discovered nodes
 
- 
destroyvoid destroy()Thestopmethod is used to stop internal services, sockets or to destroy any kind of internal state.
- 
getPartitionGroupStrategyReturns a custom implementation of aPartitionGroupStrategyto override default behavior of zone aware backup strategiesPartitionGroupMetaDataor to provide a specific behavior in case the discovery environment does not provide information about the infrastructure to be used for automatic configuration.- Parameters:
- allMembers- Current state of Cluster data members, excluding lite members
- Returns:
- a custom implementation of a PartitionGroupStrategyotherwisenullin case of the default implementation is to be used
- Since:
- 4.2.1
 
- 
getPartitionGroupStrategyDeprecated.- use the above method that takes allMember arguments Returns a custom implementation of aPartitionGroupStrategyto override default behavior of zone aware backup strategiesPartitionGroupMetaDataor to provide a specific behavior in case the discovery environment does not provide information about the infrastructure to be used for automatic configuration.- Returns:
- a custom implementation of a PartitionGroupStrategyotherwisenullin case of the default implementation is to be used
- Since:
- 3.7
 
- 
discoverLocalMetadataReturns a map with discovered metadata provided by the runtime environment. Those information may include, but are not limited, to location information like datacenter, node name or additional tags to be used for custom purpose.Information discovered from this method are shaded into the Members attributes. Existing attributes will not be overridden, that way local attribute configuration overrides provided metadata.The default implementation provides an empty map with no further metadata configured. Returning nullis not permitted and will most probably result in anNullPointerExceptioninside the cluster system.- Returns:
- a map of discovered metadata as provided by the runtime environment
- Since:
- 3.7
 
- 
markEndpointAsUnhealthyMarks the passedAddressas unhealthy, which prevents it from being offered as a viable endpoint in someDiscoveryStrategyimplementations, usually prompting this endpoint to be periodically probed for liveliness. If not supported by the underlying implementation, then this call does nothing.- Parameters:
- address- the address to mark as unhealthy
- Since:
- 5.4
 
- 
getUnhealthyEndpointsFetches a set ofAddressmarked as unhealthy by the underlying implementation. If not supported by the underlying implementation, then this call returns an empty set.- Returns:
- set of Addresswhich are currently marked as unhealthy if supported by the underlying implementation, otherwise an empty set.
- Since:
- 5.4
 
 
- 
PartitionGroupStrategyto override default behavior of zone aware backup strategiesPartitionGroupMetaDataor to provide a specific behavior in case the discovery environment does not provide information about the infrastructure to be used for automatic configuration.