added CacheRegistryUtil.clear() to avoid incosnstinency between cluster instances caching database

git-svn-id: https://svn.research-infrastructures.eu/d4science/gcube/trunk/portlets/user/join-vre@130557 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2016-07-19 15:56:20 +00:00
parent 5a9267d143
commit c048f3276c
1 changed files with 3 additions and 0 deletions

View File

@ -39,6 +39,7 @@ import org.gcube.vomanagement.usermanagement.model.MembershipRequestStatus;
import org.gcube.vomanagement.usermanagement.model.VirtualGroup;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import com.liferay.portal.kernel.cache.CacheRegistryUtil;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.log.Log;
@ -225,6 +226,7 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService
if (session.getUsername().compareTo(TEST_USER) != 0) {
GCubeUser currUser = new LiferayUserManager().getUserByUsername(session.getUsername());
//check if the user belongs to it
CacheRegistryUtil.clear();
if (gm.listGroupsByUser(currUser.getUserId()).contains(vreOrganization)) {
toAdd.setUserBelonging(UserBelonging.BELONGING);
}
@ -351,6 +353,7 @@ public class JoinServiceImpl extends RemoteServiceServlet implements JoinService
* @throws UserManagementSystemException
*/
private static boolean checkPending(String screenName, long groupId) throws UserManagementSystemException, GroupRetrievalFault, UserRetrievalFault {
CacheRegistryUtil.clear();
UserManager um = new LiferayUserManager();
List<GCubeMembershipRequest> requests = um.listMembershipRequestsByGroup(groupId);
for (GCubeMembershipRequest r : requests) {