public interface DiscoveryStrategy
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.
Modifier and Type | Method and Description |
---|---|
void |
destroy()
The
stop method is used to stop internal services, sockets or to destroy any
kind of internal state. |
Map<String,String> |
discoverLocalMetadata()
Returns a map with discovered metadata provided by the runtime environment.
|
Iterable<DiscoveryNode> |
discoverNodes()
Returns a set of all discovered nodes based on the defined properties that were used
to create the
DiscoveryStrategy instance. |
default PartitionGroupStrategy |
getPartitionGroupStrategy()
Deprecated.
- use the above method that takes allMember arguments
Returns a custom implementation of a
PartitionGroupStrategy to override
default behavior of zone aware backup strategies PartitionGroupMetaData
or to provide a specific behavior in case the discovery environment does not provide
information about the infrastructure to be used for automatic configuration. |
default PartitionGroupStrategy |
getPartitionGroupStrategy(Collection<? extends Member> allMembers)
Returns a custom implementation of a
PartitionGroupStrategy to override
default behavior of zone aware backup strategies PartitionGroupMetaData
or to provide a specific behavior in case the discovery environment does not provide
information about the infrastructure to be used for automatic configuration. |
void |
start()
The
start method is used to initialize internal state and perform any kind of
startup procedure like multicast socket creation. |
void start()
start
method 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 the DiscoveryNode
instance passed to the DiscoveryStrategyFactory
.Iterable<DiscoveryNode> discoverNodes()
DiscoveryStrategy
instance.void destroy()
stop
method is used to stop internal services, sockets or to destroy any
kind of internal state.default PartitionGroupStrategy getPartitionGroupStrategy(Collection<? extends Member> allMembers)
PartitionGroupStrategy
to override
default behavior of zone aware backup strategies PartitionGroupMetaData
or to provide a specific behavior in case the discovery environment does not provide
information about the infrastructure to be used for automatic configuration.allMembers
- Current state of Cluster data members, excluding lite membersPartitionGroupStrategy
otherwise null
in case of the default implementation is to be used@Deprecated default PartitionGroupStrategy getPartitionGroupStrategy()
PartitionGroupStrategy
to override
default behavior of zone aware backup strategies PartitionGroupMetaData
or to provide a specific behavior in case the discovery environment does not provide
information about the infrastructure to be used for automatic configuration.PartitionGroupStrategy
otherwise null
in case of the default implementation is to be usedMap<String,String> discoverLocalMetadata()
Information discovered from this method are shaded into the Member
s
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
null
is not permitted and will most probably result in an NullPointerException
inside the cluster system.
Copyright © 2023 Hazelcast, Inc.. All rights reserved.