Commit 0079d17e authored by Matt Tucker's avatar Matt Tucker Committed by matt

Performance tweak.


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@1074 b35dd754-fafc-0310-a699-88a17e54d16e
parent 74a10b28
......@@ -99,6 +99,7 @@ public class LdapUserProvider implements UserProvider {
}
public int getUserCount() {
// TODO: cache result for X minutes
int count = 0;
DirContext ctx = null;
try {
......@@ -184,6 +185,13 @@ public class LdapUserProvider implements UserProvider {
SearchControls constraints = new SearchControls();
constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
constraints.setReturningAttributes(new String[] { manager.getUsernameField() });
// Limit results to those we'll need to process unless client-side sorting
// is turned on.
if (!Boolean.valueOf(JiveGlobals.getXMLProperty(
"ldap.clientSideSorting")).booleanValue())
{
constraints.setCountLimit(startIndex+numResults);
}
String filter = "(" + manager.getUsernameField() + "=*)";
NamingEnumeration answer = ctx.search("", filter, constraints);
// If client-side sorting is enabled, read in all results, sort, then get a sublist.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment