Yes...I forgot to tell, im using java 1.50.04. I realy don't know the
solution
DirContext ctx = new InitialDirContext(env);
SearchControls ctls = new SearchControls();
ctls.setSearchScope(SearchControls.SUBTREE_SCOPE);
try{
NamingEnumeration answer = ctx.search("ou=su,O=F,C=P","M=9",ctls);
while (answer.hasMore()) {
SearchResult sr = (SearchResult)answer.next();
DoSomethingWithAttributes(sr.getAttributes());
}
}catch (NamingException nex) {
System.err.println("OOOps search timeout: " + nex.getMessage());
}
JScoobyCed - 15 Dec 2005 09:03 GMT
> Yes...I forgot to tell, im using java 1.50.04. I realy don't know the
> solution
[quoted text clipped - 12 lines]
> System.err.println("OOOps search timeout: " + nex.getMessage());
> }
Would it be possible that you have a deadlock in the
DoSomethingWithAttributes() method. You said you have about 50 Threads.
Maybe some synchronization problem. Do the attributes values go to a
database? Could it be a mutual lock between Java and database (a Thread
locking a Java code block waiting for a value from a DB table locked by
another Thread that in turns needs the locked Java code block... ARG...)

Signature
JSC
Brzi - 15 Dec 2005 10:55 GMT
No. "DoSomethingWithAttributes" simply use the attributes and make new
class.
Then that class is returned. So I don't have anything like accessing a
database.
My guess is that it is to much to handle for ldap server. I'm using one
connection for every search attempt. Maybe that is not preferable....
iksrazal@gmail.com - 15 Dec 2005 11:52 GMT
> No. "DoSomethingWithAttributes" simply use the attributes and make new
> class.
> Then that class is returned. So I don't have anything like accessing a
> database.
> My guess is that it is to much to handle for ldap server. I'm using one
> connection for every search attempt. Maybe that is not preferable....
There is of course a limit of the number of active connections
available, regardless of which ldap your using. Try using a pool whose
size matches or is less than your max limit of your ldap server:
http://java.sun.com/products/jndi/tutorial/ldap/connect/pool.html
HTH,
iksrazal
http://www.braziloutsource.com/
iksrazal@gmail.com - 15 Dec 2005 11:46 GMT
Where's ctls.setTimeLimit(5); ? That's 5 milliseconds - is that what
you really want? Your doSomething() could be really something like my
doLookup() - proven to work for me:
private Object doLookup (NamingEnumeration results, String type) throws
WSSecurityException
{
try
{
Fwlog.debug(this, Fwlog.DB, "doLookup...");
if (results.hasMore())
{
SearchResult sr = (SearchResult) results.next();
javax.naming.directory.Attributes xanswer = sr.getAttributes();
javax.naming.directory.Attribute attribute = xanswer.get(type);
// check if attribute missing
if (null==attribute)
{
throw new IllegalStateException("\nERROR: Attribute type not
found: " + type);
}
// retrieve attribute as object and return
Object o = attribute.get();
if (null == o)
{
throw new IllegalStateException("Recieved null object for
attribute type: " + type);
}
return o;
}
else
{
throw new IllegalStateException("Empty Subject recieved");
}
}//end try
catch ( Exception e )
{
Fwlog.error(this, Fwlog.DB, "doLookup() failed for for type: " +
type);
Fwlog.error(this, Fwlog.DB, e);
throw new WSSecurityException(e.toString(), e);
}
}
HTH,
iksrazal
http://www.braziloutsource.com/
Brzi - 15 Dec 2005 14:27 GMT
Well ctls.setTimeLimit(5) is not 5, its bigger....my mistake...
I will try your doLookup , but I don't think that is the case. My
function is only iterating through the attributes... thats all..
Ok..