Skip to content

Commit

Permalink
fixed multiple fallback logic
Browse files Browse the repository at this point in the history
  • Loading branch information
smadappa committed Jul 16, 2016
1 parent 9e11f4f commit c519f83
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,7 @@ public <T> Builder enableRetry() {
* @return this {@code Builder} object
*/
public <T> Builder disableRetry() {
this._serverGroupRetry = true;
this._serverGroupRetry = false;
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ public <T> T get(String key, Transcoder<T> tc) throws EVCacheException {
for (int i = 0; i < fbClients.size(); i++) {
final EVCacheClient fbClient = fbClients.get(i);
if(i >= fbClients.size() - 1) throwEx = throwExc;
data = getData(fbClient, canonicalKey, tc, throwEx, false);
data = getData(fbClient, canonicalKey, tc, throwEx, (i < fbClients.size() - 1) ? true : false);
if (log.isDebugEnabled() && shouldLog()) log.debug("Retry for APP " + _appName + ", key [" + canonicalKey + (log.isTraceEnabled() ? "], Value [" + data : "") + "], ServerGroup : " + fbClient.getServerGroup());
if (data != null) {
client = fbClient;
Expand Down Expand Up @@ -594,7 +594,7 @@ public <T> T getAndTouch(String key, int timeToLive, Transcoder<T> tc) throws EV
for (int i = 0; i < fbClients.size(); i++) {
final EVCacheClient fbClient = fbClients.get(i);
if(i >= fbClients.size() - 1) throwEx = throwExc;
data = getAndTouchData(fbClient, canonicalKey, tc, throwEx, false, timeToLive);
data = getAndTouchData(fbClient, canonicalKey, tc, throwEx, (i < fbClients.size() - 1) ? true : false, timeToLive);
if (log.isDebugEnabled() && shouldLog()) log.debug("GetAndTouch Retry for APP " + _appName + ", key [" + canonicalKey + (log.isTraceEnabled() ? "], Value [" + data : "") + "], ServerGroup : " + fbClient.getServerGroup());
if (data != null) {
client = fbClient;
Expand Down Expand Up @@ -832,7 +832,7 @@ private <T> Map<String, T> getBulk(Collection<String> keys, Transcoder<T> tc, bo
for (int i = 0; i < fbClients.size(); i++) {
final EVCacheClient fbClient = fbClients.get(i);
if(i >= fbClients.size() - 1) throwEx = throwExc;
retMap = getBulkData(fbClient, canonicalKeys, tc, throwEx, false);
retMap = getBulkData(fbClient, canonicalKeys, tc, throwEx, (i < fbClients.size() - 1) ? true : false);
if (log.isDebugEnabled() && shouldLog()) log.debug("Fallback for APP " + _appName + ", key [" + canonicalKeys + (log.isTraceEnabled() ? "], Value [" + retMap : "") + "], zone : " + fbClient.getZone());
if (retMap != null && !retMap.isEmpty()) break;
}
Expand Down

0 comments on commit c519f83

Please sign in to comment.