dasahcc commented on a change in pull request #367: Add transient cache for
CustomRestClient implementation
URL: https://github.com/apache/helix/pull/367#discussion_r309455471
##########
File path:
helix-rest/src/main/java/org/apache/helix/rest/client/CustomRestClientImpl.java
##########
@@ -97,7 +111,15 @@ public CustomRestClientImpl(HttpClient httpClient) {
kv -> result.put(kv.getKey(),
kv.getValue().get(IS_HEALTHY_FIELD).asBoolean()));
return result;
};
- return handleResponse(post(url, payLoads), jsonConverter);
+ try {
+ _semaphore.acquire();
+ return handleResponse(post(url, payLoads), jsonConverter);
+ } catch (InterruptedException e) {
+ LOG.warn("Interrupted while acquiring the semaphore", e);
+ } finally {
+ _semaphore.release();
Review comment:
That's not the method to lock, right? This is per instance check, it can be
parallel without duplication. The most duplicated requests part is partition
level checks.
Another thing here, shall we use Semaphore or we can use conditional
variable?
----------------------------------------------------------------
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