i3wangyi commented on a change in pull request #367: Add transient cache for
CustomRestClient implementation
URL: https://github.com/apache/helix/pull/367#discussion_r309460673
##########
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:
It is the partition check method. Semaphore allows multiple threads
submitting the requests while a single condition can allow up to one(and then
it becomes sequential calls), if it's a high volume traffics, performance is
not good enough.
----------------------------------------------------------------
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