public class DataNodeService extends DruidService
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).| Modifier and Type | Field and Description |
|---|---|
static String |
DISCOVERY_SERVICE_KEY |
static String |
SERVER_TYPE_PROP_KEY |
| Constructor and Description |
|---|
DataNodeService(String tier,
long maxSize,
ServerType serverType,
int priority) |
DataNodeService(String tier,
long maxSize,
ServerType serverType,
int priority,
boolean isDiscoverable) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
static DataNodeService |
fromJson(String tier,
long maxSize,
ServerType type,
ServerType serverType,
int priority)
This JSON creator requires for the "type" subtype key of
DruidService to appear before
the "type" property of this class in the serialized JSON. |
long |
getMaxSize() |
String |
getName() |
int |
getPriority() |
ServerType |
getServerType() |
String |
getTier() |
int |
hashCode() |
boolean |
isDiscoverable() |
String |
toString() |
public static final String DISCOVERY_SERVICE_KEY
public static final String SERVER_TYPE_PROP_KEY
public DataNodeService(String tier, long maxSize, ServerType serverType, int priority)
public DataNodeService(String tier, long maxSize, ServerType serverType, int priority, boolean isDiscoverable)
public static DataNodeService fromJson(String tier, long maxSize, @Deprecated @Nullable ServerType type, @Nullable ServerType serverType, int priority)
DruidService to appear before
the "type" property of this class in the serialized JSON. Deserialization can fail otherwise.
See the Javadoc of this class for more details.public String getName()
getName in class DruidServicepublic String getTier()
public long getMaxSize()
public ServerType getServerType()
public int getPriority()
public boolean isDiscoverable()
isDiscoverable in class DruidServiceCopyright © 2011–2023 The Apache Software Foundation. All rights reserved.