&& classCreateLdapConnectionPoolRule.getLdapServer() != ldapServer )
{
LOG.trace( "Creating connection pool to new ldap server" );
LdapConnectionPool oldLdapConnectionPool = ldapConnectionPool;
LdapConnectionTemplate oldLdapConnectionTemplate = ldapConnectionTemplate;
ldapConnectionPool = classCreateLdapConnectionPoolRule
.createLdapConnectionPool( ldapServer );
ldapConnectionTemplate = new LdapConnectionTemplate( ldapConnectionPool );
try
{
base.evaluate();
}
finally
{
LOG.trace( "Reverting to old connection pool" );
ldapConnectionPool = oldLdapConnectionPool;
ldapConnectionTemplate = oldLdapConnectionTemplate;
}
}
else
{
LOG.trace( "no @CreateLdapConnectionPool on: {}", description );
base.evaluate();
}
}
};
}
else
{
return new Statement()
{
@Override
public void evaluate() throws Throwable
{
LOG.trace( "Creating ldap connection pool" );
ldapConnectionPool = createLdapConnectionPool( getLdapServer() );
ldapConnectionTemplate = new LdapConnectionTemplate( ldapConnectionPool );
try
{
base.evaluate();
}