Class DiscoveryNode

java.lang.Object
com.hazelcast.spi.discovery.DiscoveryNode
Direct Known Subclasses:
SimpleDiscoveryNode

public abstract class DiscoveryNode
extends Object
A DiscoveryNode describes a nodes addresses (private and if necessary a public one) as well as attributes assigned to this node. Private address defines the typical internal communication port, all cluster communication and also client communication inside the same network happens on this address. However in cloud environments clients might run in other sub-networks and therefore cannot access the private address. In those situations DiscoveryStrategy vendors can retrieve and assign an additional external (or public) IP address of the node for clients to connect against.

Public addresses, if not necessary, can either be returned as null or may return the same address instance as the private one and will be handled internally the same way.

The properties will be used to store any kind of tags or other metadata available for the node inside of the cloud environment. If a NodeFilter is configured, these properties might be used for further refinement of the discovered nodes based on whatever the filter decides.

This class is implemented as an abstract class to offer easy extensibility in later versions of the SPI. Since Java only offers forward evolution of interfaces starting with Java 8, this is the best option.

Since:
3.6
  • Constructor Details

  • Method Details

    • getPrivateAddress

      public abstract Address getPrivateAddress()
      Returns the private address of the discovered node. The private address must not be null.
      Returns:
      the private address of the discovered node
    • getPublicAddress

      public abstract Address getPublicAddress()
      Returns the public address of the discovered node if available. Public addresses are optional and this method may return null or the same address as getPrivateAddress().
      Returns:
      the public address of the discovered node if available otherwise null or getPrivateAddress()
    • getProperties

      public abstract Map<String,​Object> getProperties()
      Returns a set of unmodifiable properties that are assigned to the discovered node. These properties can be used for additional filtering based on the NodeFilter API.
      Returns:
      assigned properties of that node