From 5e0404b9d207eb9f012030185a89044bc7e2b352 Mon Sep 17 00:00:00 2001 From: "arnett, stu" Date: Mon, 23 Nov 2015 13:46:51 -0600 Subject: [PATCH] v2.0.6 --- src/main/java/com/emc/rest/smart/Host.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/emc/rest/smart/Host.java b/src/main/java/com/emc/rest/smart/Host.java index ed6e34a..723f09c 100644 --- a/src/main/java/com/emc/rest/smart/Host.java +++ b/src/main/java/com/emc/rest/smart/Host.java @@ -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 errorWaitTime 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); @@ -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; } }