liubao68 commented on a change in pull request #1936:
URL:
https://github.com/apache/servicecomb-java-chassis/pull/1936#discussion_r481640298
##########
File path:
handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/ServiceCombServerStats.java
##########
@@ -84,20 +84,35 @@ private void init(){
}
public static boolean isolatedServerCanTry() {
- return globalAllowIsolatedServerTryingFlag.get();
+ TryingIsolatedServerMarker marker =
globalAllowIsolatedServerTryingFlag.get();
+ if (marker == null) {
+ return true;
+ }
+ return marker.isOutdated();
}
/**
* Applying for a trying chance for the isolated server. There is only 1
trying chance globally concurrently.
*
* @return true if the chance is applied successfully, otherwise false
*/
- public static boolean applyForTryingChance() {
- return isolatedServerCanTry() &&
globalAllowIsolatedServerTryingFlag.compareAndSet(true, false);
+ public static boolean applyForTryingChance(Invocation invocation) {
Review comment:
This method is not thread safe.
----------------------------------------------------------------
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]