Class DataNodeService


  • public class DataNodeService
    extends DruidService
    Metadata announced by any node that serves segments. Note for JSON serialization and deserialization. This class has a bug that it has the "type" property which is the duplicate name with the subtype key of DruidService. It seems to happen to work if the "type" subtype key appears first in the serialized JSON since Jackson uses the first "type" property as the subtype key. To always enforce this property order, this class does not use the JsonProperty annotation for serialization, but uses DruidServiceSerializer. Since this is a hacky-way to not break compatibility, a new "serverType" field is added to replace the deprecated "type" field. Once we completely remove the "type" field from this class, we can remove DruidServiceSerializer as well. The set of properties to serialize is hard-coded in DruidServiceSerializer. If you want to add a new field in this class before we remove the "type" field, you must add a proper handling of that new field in DruidServiceSerializer as well. For deserialization, DruidServices are deserialized as a part of DiscoveryDruidNode. To handle the bug of the duplicate "type" key, DiscoveryDruidNode first deserializes the JSON to StringObjectPairList, handles the duplicate "type" keys in the StringObjectPairList, and then finally converts it to a DruidService. See DiscoveryDruidNode.toMap(List).
    See Also:
    DruidServiceSerializer, DiscoveryDruidNode.toMap(List)
    • Constructor Detail

      • DataNodeService

        public DataNodeService​(String tier,
                               long maxSize,
                               ServerType serverType,
                               int priority)
      • DataNodeService

        public DataNodeService​(String tier,
                               long maxSize,
                               ServerType serverType,
                               int priority,
                               boolean isDiscoverable)
    • Method Detail

      • getTier

        public String getTier()
      • getMaxSize

        public long getMaxSize()
      • getServerType

        public ServerType getServerType()
      • getPriority

        public int getPriority()
      • isDiscoverable

        public boolean isDiscoverable()
        Overrides:
        isDiscoverable in class DruidService
        Returns:
        Whether the service should be discoverable. The default implementation returns true. Some implementations may choose to override this so that the service is not discoverable if it has not been configured. This will not throw a fatal exception, but instead will just skip binding and log a message. This could be useful for optional configuration for the service.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object