narendly commented on a change in pull request #844: Implement setRoutingData
for MetadataStoreDirectoryService
URL: https://github.com/apache/helix/pull/844#discussion_r386766561
##########
File path:
helix-rest/src/main/java/org/apache/helix/rest/metadatastore/accessor/ZkRoutingDataWriter.java
##########
@@ -209,8 +214,20 @@ public synchronized boolean setRoutingData(Map<String,
List<String>> routingData
return true;
}
- // TODO: Forward the request to leader
- return true;
+ String leaderHostName = _leaderElection.getCurrentLeaderInfo().getId();
+ String url = leaderHostName + constructUrlSuffix(
+ MetadataStoreRoutingConstants.MSDS_GET_ALL_ROUTING_DATA_ENDPOINT);
+ HttpPut httpPut = new HttpPut(url);
+ String routingDataJsonString;
+ try {
+ routingDataJsonString = new
ObjectMapper().writeValueAsString(routingData);
Review comment:
Could we create a constant variable ObjectMapper instead of creating one
every time this endpoint is called?
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
and you could use this throughout the class :)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]