From a381819e25430ccca6f3d5645d7422d1dda97c1c Mon Sep 17 00:00:00 2001
From: Nicolas Capponi <nicolas.capponi@forgerock.com>
Date: Fri, 17 Jun 2016 09:54:07 +0000
Subject: [PATCH] OPENDJ-2655 Optimize Group implementations by lazily creating examined groups

---
 opendj-server-legacy/src/main/java/org/opends/server/api/Group.java |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/api/Group.java b/opendj-server-legacy/src/main/java/org/opends/server/api/Group.java
index 5dd385f..ecb7e1f 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/api/Group.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/api/Group.java
@@ -18,6 +18,7 @@
 
 import java.util.List;
 import java.util.Set;
+import java.util.concurrent.atomic.AtomicReference;
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.opendj.config.server.ConfigException;
@@ -263,7 +264,7 @@
    */
   public boolean isMember(DN userDN) throws DirectoryException
   {
-    return userDN != null && isMember(userDN, new HashSet<DN>());
+    return userDN != null && isMember(userDN, new AtomicReference<Set<DN>>());
   }
 
   /**
@@ -297,7 +298,7 @@
    * @throws  DirectoryException  If a problem occurs while attempting
    *                              to make the determination.
    */
-  public abstract boolean isMember(DN userDN, Set<DN> examinedGroups)
+  public abstract boolean isMember(DN userDN, AtomicReference<Set<DN>> examinedGroups)
          throws DirectoryException;
 
   /**
@@ -317,7 +318,7 @@
   public boolean isMember(Entry userEntry)
          throws DirectoryException
   {
-    return isMember(userEntry, new HashSet<DN>());
+    return isMember(userEntry, new AtomicReference<Set<DN>>());
   }
 
   /**
@@ -351,8 +352,7 @@
    * @throws  DirectoryException  If a problem occurs while attempting
    *                              to make the determination.
    */
-  public abstract boolean isMember(Entry userEntry,
-                                   Set<DN> examinedGroups)
+  public abstract boolean isMember(Entry userEntry, AtomicReference<Set<DN>> examinedGroups)
          throws DirectoryException;
 
   /**

--
Gitblit v1.10.0