Synchronize user adding.
Synchronize user adding to avoid duplicates.
Fixes wso2/micro-integrator/issues/2262
@@ -172,8 +172,10 @@ public class UsersResource extends UserResource {
LOG.debug("Adding user, id: " + user + ", roleList: " + Arrays.toString(roleList));
}
try {
+ synchronized (this) {
getUserStore().addUser(user, payload.get(PASSWORD).getAsString(),
roleList, null, null);
+ }
} catch (UserAlreadyExistsException e) {
throw new IOException("User: " + user + " already exists.", e);
}
