use of com.zimbra.cs.ldap.LdapServerConfig.ZimbraLdapConfig in project zm-mailbox by Zimbra.
the class UBIDLdapContext method init.
public static synchronized void init(boolean alwaysUseMaster) throws LdapException {
assert (!initialized);
if (initialized) {
return;
}
initialized = true;
try {
masterConfig = new ZimbraLdapConfig(LdapServerType.MASTER);
masterConnPool = LdapConnectionPool.createConnectionPool(LdapConnectionPool.CP_ZIMBRA_MASTER, masterConfig);
} catch (LdapException e) {
ZimbraLog.ldap.info("master is down, falling back to replica...");
replicaConfig = new ZimbraLdapConfig(LdapServerType.REPLICA);
replicaConnPool = LdapConnectionPool.createConnectionPool(LdapConnectionPool.CP_ZIMBRA_REPLICA, replicaConfig);
masterConfig = replicaConfig;
masterConnPool = replicaConnPool;
ZimbraLog.ldap.info("using replica");
}
if (alwaysUseMaster) {
replicaConfig = masterConfig;
replicaConnPool = masterConnPool;
} else {
if (replicaConfig == null) {
replicaConfig = new ZimbraLdapConfig(LdapServerType.REPLICA);
}
if (replicaConnPool == null) {
replicaConnPool = LdapConnectionPool.createConnectionPool(LdapConnectionPool.CP_ZIMBRA_REPLICA, replicaConfig);
}
}
}
Aggregations