use of com.netflix.loadbalancer.AbstractLoadBalancer in project java-chassis by ServiceComb.
the class SessionStickinessRule method isErrorThresholdMet.
private boolean isErrorThresholdMet() {
AbstractLoadBalancer lb = (AbstractLoadBalancer) getLoadBalancer();
LoadBalancerStats stats = lb.getLoadBalancerStats();
if (stats != null && stats.getServerStats() != null && stats.getServerStats().size() > 0) {
ServerStats serverStats = stats.getSingleServerStat(lastServer);
int successiveFaildCount = serverStats.getSuccessiveConnectionFailureCount();
if (Configuration.INSTANCE.getSuccessiveFailedTimes() > 0 && successiveFaildCount >= Configuration.INSTANCE.getSuccessiveFailedTimes()) {
serverStats.clearSuccessiveConnectionFailureCount();
return true;
}
}
return false;
}
use of com.netflix.loadbalancer.AbstractLoadBalancer in project incubator-servicecomb-java-chassis by apache.
the class SessionStickinessRule method isErrorThresholdMet.
private boolean isErrorThresholdMet() {
AbstractLoadBalancer lb = (AbstractLoadBalancer) getLoadBalancer();
LoadBalancerStats stats = lb.getLoadBalancerStats();
if (stats != null && stats.getServerStats() != null && stats.getServerStats().size() > 0) {
ServerStats serverStats = stats.getSingleServerStat(lastServer);
int successiveFaildCount = serverStats.getSuccessiveConnectionFailureCount();
if (Configuration.INSTANCE.getSuccessiveFailedTimes(microserviceName) > 0 && successiveFaildCount >= Configuration.INSTANCE.getSuccessiveFailedTimes(microserviceName)) {
serverStats.clearSuccessiveConnectionFailureCount();
return true;
}
}
return false;
}
use of com.netflix.loadbalancer.AbstractLoadBalancer in project java-chassis by ServiceComb.
the class SessionStickinessRule method chooseNextServer.
private Server chooseNextServer(Object key) {
AbstractLoadBalancer lb = (AbstractLoadBalancer) getLoadBalancer();
triggerRule.setLoadBalancer(lb);
lastServer = triggerRule.choose(key);
lastAccessedTime = System.currentTimeMillis();
return lastServer;
}
use of com.netflix.loadbalancer.AbstractLoadBalancer in project incubator-servicecomb-java-chassis by apache.
the class SessionStickinessRule method chooseNextServer.
private Server chooseNextServer(Object key) {
AbstractLoadBalancer lb = (AbstractLoadBalancer) getLoadBalancer();
triggerRule.setLoadBalancer(lb);
lastServer = triggerRule.choose(key);
lastAccessedTime = System.currentTimeMillis();
return lastServer;
}
Aggregations