C
Cram TeXeD
Hi guys !
I get a odd behave in the followings lines (cf. below)
I parse a NamingEnumeration to build up a XML document.
My LDAP searches got back one record.
the instructions look like :
----------------------------------------------------
long startTime = System.currentTimeMillis();
long endLoop = 0;
While ( enum.hasMore()) {
// some relatively heavy stuff
System.currentTimeMillis() - start // get 0-40 ms
endLoop = System.currentTimeMillis();
}
System.currentTimeMillis() - endLoop // get 2500-3000 ms
----------------------------------------------------
I have found out a time gap between the end of the "While block" and
after the block I cant' explain to myself ( about 2500 ms ! ).
Do anybody get an idea ?
Thanks !
Cram
----------------------------------------------------------
full code is :
public static Element createEntry (NamingEnumeration enum,
String baseDn ) throws NamingException {
if ( enum == null )
return null;
Element cache = new DefaultElement("entry-list");
boolean log = false;
// - GET START -
long start = System.currentTimeMillis();
long endLoop = 0;
// - WHILE BLOCK BEGIN -
while (enum.hasMore()) {
SearchResult sr = (SearchResult) enum.next();
String name = sr.getName();
if ( sr.isRelative() ) {
name = name+","+baseDn;
}
Element entry = new DefaultElement("entry");
cache.add(entry);
Element dn = new DefaultElement("dn");
dn.add ( createValue( name ));
entry.add(dn);
Attributes attsVal = sr.getAttributes();
NamingEnumeration attEnum = attsVal.getAll();
while ( attEnum.hasMore() ){
Attribute att = (Attribute) attEnum.next();
// - parsing the attributes object
entry.add(createAttribute( att ));
}
System.out.println( System.currentTimeMillis() - start );
endLoop = System.currentTimeMillis();
}
// - WHILE BLOCK END
// - From the "WHILE BLOCK END" -
System.out.println( System.currentTimeMillis() - endLoop );
// - From the beginning
System.out.println( System.currentTimeMillis() - start );
return cache;
}
I get a odd behave in the followings lines (cf. below)
I parse a NamingEnumeration to build up a XML document.
My LDAP searches got back one record.
the instructions look like :
----------------------------------------------------
long startTime = System.currentTimeMillis();
long endLoop = 0;
While ( enum.hasMore()) {
// some relatively heavy stuff
System.currentTimeMillis() - start // get 0-40 ms
endLoop = System.currentTimeMillis();
}
System.currentTimeMillis() - endLoop // get 2500-3000 ms
----------------------------------------------------
I have found out a time gap between the end of the "While block" and
after the block I cant' explain to myself ( about 2500 ms ! ).
Do anybody get an idea ?
Thanks !
Cram
----------------------------------------------------------
full code is :
public static Element createEntry (NamingEnumeration enum,
String baseDn ) throws NamingException {
if ( enum == null )
return null;
Element cache = new DefaultElement("entry-list");
boolean log = false;
// - GET START -
long start = System.currentTimeMillis();
long endLoop = 0;
// - WHILE BLOCK BEGIN -
while (enum.hasMore()) {
SearchResult sr = (SearchResult) enum.next();
String name = sr.getName();
if ( sr.isRelative() ) {
name = name+","+baseDn;
}
Element entry = new DefaultElement("entry");
cache.add(entry);
Element dn = new DefaultElement("dn");
dn.add ( createValue( name ));
entry.add(dn);
Attributes attsVal = sr.getAttributes();
NamingEnumeration attEnum = attsVal.getAll();
while ( attEnum.hasMore() ){
Attribute att = (Attribute) attEnum.next();
// - parsing the attributes object
entry.add(createAttribute( att ));
}
System.out.println( System.currentTimeMillis() - start );
endLoop = System.currentTimeMillis();
}
// - WHILE BLOCK END
// - From the "WHILE BLOCK END" -
System.out.println( System.currentTimeMillis() - endLoop );
// - From the beginning
System.out.println( System.currentTimeMillis() - start );
return cache;
}