on 05-19-2006 10:27 AM
Hi,
I have a problem retrieving a list of users who are member of a specific role.
Please note: We are connected to LDAP which contains 150K users
I have the following code:
List userList = new ArrayList();
Iterator userMembersIterator;
try {
IUserFactory userFactory = UMFactory.getUserFactory();
IRoleFactory roleFactory = UMFactory.getRoleFactory();
IRoleSearchFilter roleSearchFilter = roleFactory.getRoleSearchFilter();
roleSearchFilter.setUniqueName(roleID, ISearchAttribute.LIKE_OPERATOR, true);
roleSearchFilter.setMaxSearchResultSize(100);
ISearchResult results = roleFactory.searchRoles(roleSearchFilter);
if (results.hasNext()) {
userMembersIterator = roleFactory.getRole((String)results.next()).getUserMembers(true);
while (userMembersIterator.hasNext() && cnt < 100) {
userList.add(userFactory.getUser((String)userMembersIterator.next()).getDisplayName());
cnt++;
}
}
}
catch (UMException e) {
//log.error("An error occured while getting the list of roles. Exception: " + e, e);
}
However, when retrieving a large amount of users (<i>i.e. getting the results for a role which has 90K users attached</i>), I receive NullPointerExceptions, Out of Memory errors, PortalRuntimeErrors, and I have to restart SAP WAS subsequently.
When retrieving a small list of users (<i>i.e. getting the results for a role which has only a small number of users attached</i>), everything works as expected.
We use a server with 4 CPU, 16GB memory.
Is there a way to limit the results for the getUserMembers() method, or retrieving the users in a batch of say 100 each?
Any help on this matter would be greatly appreciated!
With kind regards,
Robin van het Hof
Message was edited by: Robin van het Hof
Hi Robin,
I guess for unlimited search result you will have to specify limit of '0' or smaller.
roleSearchFilter.setMaxSearchResultSize(-1);
You can see API for more details at:
https://media.sdn.sap.com/javadocs/NW04/SP9/ume/com/sap/security/api/IPrincipalSearchFilter.html
ps: now I know why I see so many mails for dev Portal restart
Regards,
Piyush
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Robin,
I just realized that there is Out of Memory exception and causing JVM Crash
That means either ,
1) VM cannot allocate memory for new objects due to unavailability of space in heap
2)classloader tries to load new class but cannot do due to permspace of the memory is full
In your case it looks 1 is causing the problem.
If JVM Setting is already set to
-verbose:gc
-XX:+PrintGCDetails
-XX:+PrintGCTimeStamps
-XX:+PrintCompliation
Run the VM with -server -client
then check std_server0.out logs and see the method which causes the crash (if there)
Regards,
Piyush
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try setting a max on the filter like the following.
roleSearchFilter.setMaxSearchResultSize(1000000);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.