details: https://code.openbravo.com/erp/devel/pi/rev/48248d89f4ba changeset: 30646:48248d89f4ba user: Carlos Aristu <carlos.aristu <at> openbravo.com> date: Tue Nov 15 08:36:29 2016 +0100 summary: fixes issue 34499: CachedPreference feature does not support clustering
The CachedPreference was being used as a singleton which was keeping a set of preferences defined at System Level in a cache. Those values can be refreshed with the PreferenceEventHandler every time it detects a change. This mechanism was not valid for clustered environments because changes were being detected just on the node (JVM) where the event handler was executed. To fix this problem we have modified the scope of the class from application to session. Thus, the cache will be initialized on every new session created on each node of the cluster. diffstat: modules/org.openbravo.client.application/src/org/openbravo/client/application/CachedPreference.java | 8 ++------ 1 files changed, 2 insertions(+), 6 deletions(-) diffs (26 lines): diff -r e4be1dd0c5d3 -r 48248d89f4ba modules/org.openbravo.client.application/src/org/openbravo/client/application/CachedPreference.java --- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/CachedPreference.java Mon Nov 14 17:51:38 2016 +0100 +++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/CachedPreference.java Tue Nov 15 08:36:29 2016 +0100 @@ -24,7 +24,7 @@ import java.util.List; import java.util.Map; -import javax.enterprise.context.ApplicationScoped; +import javax.enterprise.context.SessionScoped; import org.openbravo.dal.core.OBContext; import org.openbravo.dal.service.OBDal; @@ -45,12 +45,8 @@ * the cached preferences values, and it that case it invalidates the stored value. This way the * next time it is requested, the current value will be retrieved from database again. * - * This mechanism for automatic refresh the preference value, only works on environments with a - * single JVM. In case of Tomcat clustering environments (multiple JVM) it will be necessary to - * restart Tomcat to retrieve the new value of the preference in every JVM. - * */ -@ApplicationScoped +@SessionScoped public class CachedPreference { public static final String ALLOW_UNPAGED_DS_MANUAL_REQUEST = "OBJSON_AllowUnpagedDatasourceManualRequest"; public static final String ALLOW_UNSECURED_DS_REQUEST = "OBSERDS_AllowUnsecuredDatasourceRequest"; ------------------------------------------------------------------------------ _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits