diff --git a/src/main/java/org/opensearch/security/user/User.java b/src/main/java/org/opensearch/security/user/User.java index 05753903df..2642b368d7 100644 --- a/src/main/java/org/opensearch/security/user/User.java +++ b/src/main/java/org/opensearch/security/user/User.java @@ -272,13 +272,13 @@ public synchronized final Map getCustomAttributesMap() { return attributes; } - public synchronized final void addSecurityRoles(final Collection securityRoles) { + public final void addSecurityRoles(final Collection securityRoles) { if (securityRoles != null && this.securityRoles != null) { this.securityRoles.addAll(securityRoles); } } - public synchronized final Set getSecurityRoles() { + public final Set getSecurityRoles() { return this.securityRoles == null ? Collections.synchronizedSet(Collections.emptySet()) : Collections.unmodifiableSet(this.securityRoles);