Skip to content

Commit

Permalink
LPS-56505 Retry on CME
Browse files Browse the repository at this point in the history
  • Loading branch information
mtambara authored and brianchandotcom committed Sep 5, 2015
1 parent b2c224f commit 1df9b84
Showing 1 changed file with 27 additions and 16 deletions.
43 changes: 27 additions & 16 deletions portal-service/src/com/liferay/portal/util/SessionClicks.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import com.liferay.portlet.PortalPreferences;
import com.liferay.portlet.PortletPreferencesFactoryUtil;

import java.util.ConcurrentModificationException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

Expand Down Expand Up @@ -94,26 +96,35 @@ public static void put(
return;
}

try {
PortalPreferences preferences =
PortletPreferencesFactoryUtil.getPortalPreferences(request);
while (true) {
try {
PortalPreferences preferences =
PortletPreferencesFactoryUtil.getPortalPreferences(request);

int size = preferences.size();
int size = preferences.size();

if (size <= _SESSION_CLICKS_MAX_ALLOWED_VALUES) {
preferences.setValue(namespace, key, value);
}
else {
if (_log.isWarnEnabled()) {
_log.warn(
"Session clicks has attempted to exceed the maximum " +
"number of allowed values with {key=" + key +
", value=" + value + "}");
if (size <= _SESSION_CLICKS_MAX_ALLOWED_VALUES) {
preferences.setValue(namespace, key, value);
}
else {
if (_log.isWarnEnabled()) {
_log.warn(
"Session clicks has attempted to exceed the " +
"maximum number of allowed values with {key=" +
key + ", value=" + value + "}");
}
}

break;
}
catch (ConcurrentModificationException cme) {
continue;
}
catch (Exception e) {
_log.error(e, e);

break;
}
}
catch (Exception e) {
_log.error(e, e);
}
}

Expand Down

0 comments on commit 1df9b84

Please sign in to comment.