Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Retrieving list of users within role failed

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

Former Member

Helpful Answer

by
Not what you were looking for? View more on this topic or Ask a question