| | |
| | | { |
| | | synchronized (connectThreadLock) |
| | | { |
| | | final Map<HostPort, Long> blacklistedHosts = new HashMap<>(); |
| | | while (!shutdown.get()) |
| | | { |
| | | HostPort localAddress = HostPort.localAddress(getReplicationPort()); |
| | |
| | | continue; // Skip: avoid connecting to self. |
| | | } |
| | | |
| | | connect(rsAddress, domain.getBaseDN()); |
| | | if (blacklistedHosts.getOrDefault(rsAddress, 0L) > domainTicket) |
| | | { |
| | | continue; // Skip: avoid connecting to blacklisted hosts. |
| | | } |
| | | |
| | | if (!connect(rsAddress, domain.getBaseDN())) |
| | | { |
| | | // Blacklist for a few iterations |
| | | blacklistedHosts.put(rsAddress, domainTicket + 6); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | * @param baseDN |
| | | * The baseDN of the connection |
| | | */ |
| | | private void connect(HostPort remoteServerAddress, DN baseDN) |
| | | private boolean connect(HostPort remoteServerAddress, DN baseDN) |
| | | { |
| | | boolean sslEncryption = replSessionSecurity.isSslEncryption(); |
| | | |
| | |
| | | logger.traceException(e); |
| | | close(session); |
| | | close(socket); |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** Initialization function for the replicationServer. */ |