Skip to content

Commit

Permalink
v2.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
arnett, stu committed Nov 23, 2015
1 parent befdfa3 commit 5e0404b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main/java/com/emc/rest/smart/Host.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* - lower response index means the host is more likely to be used
* - should be based primarily on number of open connections to the host
* - an error will mark the host as unhealthy for <code>errorWaitTime</code> milliseconds
* - multiple consecutive errors compound the unhealthy (cool down) period
* - multiple consecutive errors compound the unhealthy (cool down) period up to 8x the errorWaitTime
*/
public class Host implements HostStats {
private static final Logger l4j = Logger.getLogger(Host.class);
Expand Down Expand Up @@ -98,8 +98,9 @@ public boolean isHealthy() {
if (!healthy) return false;
else if (consecutiveErrors == 0) return true;
else {
long coolDownPower = consecutiveErrors > 3 ? 3 : consecutiveErrors - 1;
long msSinceLastUse = System.currentTimeMillis() - lastConnectionTime;
long errorCoolDown = (long) Math.pow(2, consecutiveErrors - 1) * errorWaitTime;
long errorCoolDown = (long) Math.pow(2, coolDownPower) * errorWaitTime;
return msSinceLastUse > errorCoolDown;
}
}
Expand Down

0 comments on commit 5e0404b

Please sign in to comment.