Class NetworkClusterNode

java.lang.Object
eu.cloudnetservice.driver.network.cluster.NetworkClusterNode
All Implemented Interfaces:
eu.cloudnetservice.common.document.property.DefaultedDocPropertyHolder<eu.cloudnetservice.common.document.gson.JsonDocument,NetworkClusterNode>, eu.cloudnetservice.common.document.property.DocPropertyHolder<eu.cloudnetservice.common.document.gson.JsonDocument,NetworkClusterNode>

public final class NetworkClusterNode extends Object implements eu.cloudnetservice.common.document.property.DefaultedDocPropertyHolder<eu.cloudnetservice.common.document.gson.JsonDocument,NetworkClusterNode>
Represents a general information holder about a node running in a cluster. Every node knows this information about each node which runs in the cluster, even if the node is not connected.
Since:
4.0
  • Field Details

    • uniqueId

      private final String uniqueId
    • listeners

      private final List<HostAndPort> listeners
    • properties

      private final eu.cloudnetservice.common.document.gson.JsonDocument properties
  • Constructor Details

    • NetworkClusterNode

      public NetworkClusterNode(@NonNull @NonNull String uniqueId, @NonNull @NonNull List<HostAndPort> listeners)
      Creates a new instance of a network cluster node.
      Parameters:
      uniqueId - the unique id of the node.
      listeners - the listeners of the node which are always running.
      Throws:
      NullPointerException - if either the id or listener array is null.
    • NetworkClusterNode

      public NetworkClusterNode(@NonNull @NonNull String uniqueId, @NonNull @NonNull List<HostAndPort> listeners, @NonNull @NonNull eu.cloudnetservice.common.document.gson.JsonDocument properties)
      Creates a new instance of a network cluster node.
      Parameters:
      uniqueId - the unique id of the node.
      listeners - the listeners of the node which are always running.
      properties - the properties which are set for this node, mainly for developers to store information.
      Throws:
      NullPointerException - if either the id or listener array is null.
  • Method Details

    • uniqueId

      @NonNull public @NonNull String uniqueId()
      Get the unique id of this node.
      Returns:
      the unique id of this node.
    • listeners

      @NonNull public @NonNull List<HostAndPort> listeners()
      Get all listener of this node.
      Returns:
      all listener of this node.
    • propertyHolder

      @NonNull public @NonNull eu.cloudnetservice.common.document.gson.JsonDocument propertyHolder()
      Specified by:
      propertyHolder in interface eu.cloudnetservice.common.document.property.DocPropertyHolder<eu.cloudnetservice.common.document.gson.JsonDocument,NetworkClusterNode>
    • equals

      public boolean equals(@Nullable @Nullable Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object