From ec24beaa1a1d1cfcf2252cd39aaba5a76905ed63 Mon Sep 17 00:00:00 2001 From: James Moger Date: Tue, 28 Jan 2014 13:41:22 -0500 Subject: [PATCH] issue-323: Synchronize all user service methods --- .../java/com/gitblit/ConfigUserService.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/gitblit/ConfigUserService.java b/src/main/java/com/gitblit/ConfigUserService.java index e8652252..a2a3277e 100644 --- a/src/main/java/com/gitblit/ConfigUserService.java +++ b/src/main/java/com/gitblit/ConfigUserService.java @@ -133,7 +133,7 @@ public class ConfigUserService implements IUserService { * @return cookie value */ @Override - public String getCookie(UserModel model) { + public synchronized String getCookie(UserModel model) { if (!StringUtils.isEmpty(model.cookie)) { return model.cookie; } @@ -195,7 +195,7 @@ public class ConfigUserService implements IUserService { * @return true if update is successful */ @Override - public boolean updateUserModel(UserModel model) { + public synchronized boolean updateUserModel(UserModel model) { return updateUserModel(model.username, model); } @@ -325,7 +325,7 @@ public class ConfigUserService implements IUserService { * @return true if successful */ @Override - public boolean deleteUserModel(UserModel model) { + public synchronized boolean deleteUserModel(UserModel model) { return deleteUser(model.username); } @@ -372,7 +372,7 @@ public class ConfigUserService implements IUserService { * @since 0.8.0 */ @Override - public List getAllTeamNames() { + public synchronized List getAllTeamNames() { read(); List list = new ArrayList(teams.keySet()); Collections.sort(list); @@ -447,7 +447,7 @@ public class ConfigUserService implements IUserService { * @since 0.8.0 */ @Override - public boolean updateTeamModel(TeamModel model) { + public synchronized boolean updateTeamModel(TeamModel model) { return updateTeamModel(model.name, model); } @@ -459,7 +459,7 @@ public class ConfigUserService implements IUserService { * @since 1.2.0 */ @Override - public boolean updateTeamModels(Collection models) { + public synchronized boolean updateTeamModels(Collection models) { try { read(); for (TeamModel team : models) { @@ -485,7 +485,7 @@ public class ConfigUserService implements IUserService { * @since 0.8.0 */ @Override - public boolean updateTeamModel(String teamname, TeamModel model) { + public synchronized boolean updateTeamModel(String teamname, TeamModel model) { TeamModel original = null; try { read(); @@ -514,7 +514,7 @@ public class ConfigUserService implements IUserService { * @since 0.8.0 */ @Override - public boolean deleteTeamModel(TeamModel model) { + public synchronized boolean deleteTeamModel(TeamModel model) { return deleteTeam(model.name); } @@ -526,7 +526,7 @@ public class ConfigUserService implements IUserService { * @since 0.8.0 */ @Override - public boolean deleteTeam(String teamname) { + public synchronized boolean deleteTeam(String teamname) { try { // Read realm file read(); @@ -545,7 +545,7 @@ public class ConfigUserService implements IUserService { * @return list of all usernames */ @Override - public List getAllUsernames() { + public synchronized List getAllUsernames() { read(); List list = new ArrayList(users.keySet()); Collections.sort(list); -- 2.39.5