| | |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | import java.io.IOException; |
| | | import java.net.*; |
| | | import java.util.*; |
| | | import java.net.InetAddress; |
| | | import java.net.InetSocketAddress; |
| | | import java.net.ServerSocket; |
| | | import java.net.Socket; |
| | | import java.net.UnknownHostException; |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.HashMap; |
| | | import java.util.HashSet; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.util.concurrent.CopyOnWriteArraySet; |
| | | import java.util.concurrent.atomic.AtomicBoolean; |
| | | |
| | |
| | | import org.forgerock.i18n.slf4j.LocalizedLogger; |
| | | import org.forgerock.opendj.config.server.ConfigChangeResult; |
| | | import org.forgerock.opendj.config.server.ConfigException; |
| | | import org.forgerock.opendj.config.server.ConfigurationChangeListener; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.forgerock.opendj.ldap.ResultCode; |
| | | import org.forgerock.opendj.ldap.SearchScope; |
| | | import org.forgerock.opendj.config.server.ConfigurationChangeListener; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.server.config.meta.VirtualAttributeCfgDefn.ConflictBehavior; |
| | | import org.forgerock.opendj.server.config.server.ReplicationServerCfg; |
| | | import org.forgerock.opendj.server.config.server.UserDefinedVirtualAttributeCfg; |
| | |
| | | import org.opends.server.replication.server.changelog.file.ECLEnabledDomainPredicate; |
| | | import org.opends.server.replication.server.changelog.file.FileChangelogDB; |
| | | import org.opends.server.replication.service.DSRSShutdownSync; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.forgerock.opendj.ldap.DN; |
| | | import org.opends.server.types.DirectoryException; |
| | | import org.opends.server.types.HostPort; |
| | | import org.opends.server.types.SearchFilter; |
| | |
| | | private ReplicationServerCfg config; |
| | | private final DSRSShutdownSync dsrsShutdownSync; |
| | | |
| | | /** |
| | | * This table is used to store the list of dn for which we are currently |
| | | * handling servers. |
| | | */ |
| | | /** This table is used to store the list of dn for which we are currently handling servers. */ |
| | | private final Map<DN, ReplicationServerDomain> baseDNs = new HashMap<>(); |
| | | |
| | | /** The database storing the changes. */ |
| | |
| | | newSocket.setTcpNoDelay(true); |
| | | newSocket.setKeepAlive(true); |
| | | int timeoutMS = MultimasterReplication.getConnectionTimeoutMS(); |
| | | session = replSessionSecurity.createServerSession(newSocket, |
| | | timeoutMS); |
| | | session = replSessionSecurity.createServerSession(newSocket, timeoutMS); |
| | | if (session == null) // Error, go back to accept |
| | | { |
| | | continue; |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Waits for connections to this ReplicationServer. |
| | | */ |
| | | /** Waits for connections to this ReplicationServer. */ |
| | | void waitConnections() |
| | | { |
| | | // Acquire a domain ticket and wait for a complete cycle of the connect |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Shutdown the Replication Server service and all its connections. |
| | | */ |
| | | /** Shutdown the Replication Server service and all its connections. */ |
| | | public void shutdown() |
| | | { |
| | | localPorts.remove(getReplicationPort()); |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public ConfigChangeResult applyConfigurationChange( |
| | | ReplicationServerCfg configuration) |
| | |
| | | stopListen = true; |
| | | try |
| | | { |
| | | listenSocket.close(); |
| | | listenThread.join(); |
| | | close(listenSocket); |
| | | if (listenThread != null) |
| | | { |
| | | listenThread.join(); |
| | | } |
| | | stopListen = false; |
| | | |
| | | setServerURL(); |
| | |
| | | */ |
| | | for (HostPort rsAddress : getConfiguredRSAddresses()) |
| | | { |
| | | /* |
| | | * No need validate the string format because the admin framework has |
| | | * already done it. |
| | | */ |
| | | /* No need validate the string format because the admin framework has already done it. */ |
| | | if (rsAddress.getPort() == getReplicationPort() |
| | | && rsAddress.isLocalAddress()) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public boolean isConfigurationChangeAcceptable( |
| | | ReplicationServerCfg configuration, List<LocalizableMessage> unacceptableReasons) |
| | |
| | | * Get the serverId for this replication server. |
| | | * |
| | | * @return The value of the serverId. |
| | | * |
| | | */ |
| | | public int getServerId() |
| | | { |
| | |
| | | * WARNING : only use this methods for tests purpose. |
| | | * |
| | | * Clear the list of local Replication Servers |
| | | * |
| | | */ |
| | | public static void onlyForTestsClearLocalReplicationServerList() |
| | | { |
| | |
| | | return MultimasterReplication.isECLEnabled(); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | | @Override |
| | | public String toString() |
| | | { |
| | | return "RS(" + getServerId() + ") on " + serverURL + ", domains=" |
| | | + baseDNs.keySet(); |
| | | return "RS(" + getServerId() + ") on " + serverURL + ", domains=" + baseDNs.keySet(); |
| | | } |
| | | |
| | | } |