Interface DiscoveryService
DiscoveryService
interface defines the basic entry point
into the Discovery SPI implementation. If not overridden explicitly the Hazelcast
internal DefaultDiscoveryService
implementation is used. A DiscoveryService
somehow finds available
DiscoveryStrategy
s inside the classpath and manages their activation
or deactivation status.
This interface is used by system integrators, integrating Hazelcast into their own frameworks or environments, are free to extend or exchange the default implementation based on their needs and requirements.
Only enabled providers are expected to discover nodes but, depending on the
DiscoveryService
implementation, multiple DiscoveryStrategy
s
might be enabled at the same time (e.g. TCP-IP Joiner with well known addresses
and Cloud discovery).
- Since:
- 3.6
-
Method Summary
Modifier and TypeMethodDescriptionvoid
destroy()
Thestart
method is called on system startup to implement simple lifecycle management.Returns a map with discovered metadata provided by the runtime environment.Returns a discovered and filtered, if aNodeFilter
is setup, set of discovered nodes to connect to.Fetches a set ofAddress
marked as unhealthy by the underlyingDiscoveryStrategy
.default void
markEndpointAsUnhealthy
(Address address) Marks the passedAddress
as unhealthy, which prevents it from being offered as a viable endpoint in someDiscoveryStrategy
implementations, usually prompting this endpoint to be periodically probed for liveliness.void
start()
Thestart
method is called on system startup to implement simple lifecycle management.
-
Method Details
-
start
void start()Thestart
method is called on system startup to implement simple lifecycle management. This method is expected to callDiscoveryStrategy.start()
on all discovered and start up strategies. -
discoverNodes
Iterable<DiscoveryNode> discoverNodes()Returns a discovered and filtered, if aNodeFilter
is setup, set of discovered nodes to connect to.- Returns:
- a set of discovered and filtered nodes
-
destroy
void destroy()Thestart
method is called on system startup to implement simple lifecycle management. This method is expected to callDiscoveryStrategy.destroy()
on all discovered and destroy strategies before the service itself will be destroyed. -
discoverLocalMetadata
Returns a map with discovered metadata provided by the runtime environment. Those information may include, but are not limited, to location information like datacenter or additional tags to be used for custom purpose.Information discovered from this method are copied into the
Member
s attributes. Existing attributes will be overridden.The default implementation provides an empty map with no further metadata configured. Returning
null
is not permitted and will most probably result in anNullPointerException
inside the cluster system.- Returns:
- a map of discovered metadata as provided by the runtime environment
- Since:
- 3.7
-
markEndpointAsUnhealthy
Marks the passedAddress
as unhealthy, which prevents it from being offered as a viable endpoint in someDiscoveryStrategy
implementations, 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
- See Also:
-
getUnhealthyEndpoints
Fetches a set ofAddress
marked as unhealthy by the underlyingDiscoveryStrategy
. If not supported by the underlying implementation, then this call returns an empty set.- Returns:
- set of
Address
which are currently marked as unhealthy if supported by the underlying implementation, otherwise an empty set. - Since:
- 5.4
- See Also:
-