Entry entry1 = null;
Entry entry2 = null;
Entry entry3 = null;
long ns0 = System.currentTimeMillis();
EntryCursor results = connection.search( "dc=example,dc=com",
"(displayName=1234Awg-Rosli, Awg-Abd-Rahim SMDS-UIA/G/MMO52D)", SearchScope.SUBTREE, "*" );
while ( results.next() )
{
if ( entry1 == null )
{
entry1 = results.get();
}
}
results.close();
long ns1 = System.currentTimeMillis();
System.out.println( "Delta search : " + ( ns1 - ns0 ) );
long ns2 = System.currentTimeMillis();
results = connection.search( "dc=example,dc=com", "(displayName=3456*)", SearchScope.SUBTREE, "*" );
while ( results.next() )
{
if ( entry2 == null )
{
entry2 = results.get();
}
}
results.close();
long ns3 = System.currentTimeMillis();
System.out.println( "Delta search substring : " + ( ns3 - ns2 ) );
long ns4 = System.currentTimeMillis();
results = connection.search( "dc=example,dc=com", "(uid=6789)", SearchScope.SUBTREE, "*" );
while ( results.next() )
{
if ( entry3 == null )
{
entry3 = results.get();
}
}
results.close();
long ns5 = System.currentTimeMillis();
System.out.println( "Delta search no index : " + ( ns5 - ns4 ) );
//System.out.println( "Entry 1 : " + entry1 );
//System.out.println( "Entry 2 : " + entry2 );
//System.out.println( "Entry 3 : " + entry3 );
connection.close();
// Now, shutdown and restart the server once more
System.out.println( "--------------> Shuting Down" );
long ns6 = System.currentTimeMillis();
getService().shutdown();
long ns7 = System.currentTimeMillis();
System.out.println( "--------------> completed in " + ( ns7 - ns6 ) );
long ns8 = System.currentTimeMillis();
getService().startup();
long ns9 = System.currentTimeMillis();
System.out.println( "--------------> Starting up completed in " + ( ns9 - ns8 ) );
// and do a search again
connection = ( LdapNetworkConnection ) LdapApiIntegrationUtils.getPooledAdminConnection( getLdapServer() );
long ns10 = System.currentTimeMillis();
results = connection.search( "dc=example,dc=com", "(displayName=345*)", SearchScope.SUBTREE, "*" );
while ( results.next() )
{
entry3 = results.get();
break;
}
results.close();
long ns11 = System.currentTimeMillis();
System.out.println( "New Delta search substring : " + ( ns11 - ns10 ) );
connection.close();
// And again
// Now, shutdown and restart the server once more
System.out.println( "--------------> Shuting Down 2" );
long ns12 = System.currentTimeMillis();
getService().shutdown();
long ns13 = System.currentTimeMillis();
System.out.println( "--------------> completed in " + ( ns13 - ns12 ) );
long ns14 = System.currentTimeMillis();
getService().startup();
long ns15 = System.currentTimeMillis();
System.out.println( "--------------> Starting up completed in " + ( ns15 - ns14 ) );
// and do a search again
connection = ( LdapNetworkConnection ) LdapApiIntegrationUtils.getPooledAdminConnection( getLdapServer() );
long ns16 = System.currentTimeMillis();
results = connection.search( "dc=example,dc=com", "(displayName=345*)", SearchScope.SUBTREE, "*" );
while ( results.next() )
{
entry3 = results.get();
break;
}
results.close();
long ns17 = System.currentTimeMillis();
System.out.println( "New Delta search substring : " + ( ns17 - ns16 ) );
connection.close();
}