mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

pgamba
17.00.2007 bd724fad0c954f1e607a0a90cbca3eb41d1f2460
opends/src/server/org/opends/server/replication/server/ReplicationServer.java
@@ -130,6 +130,14 @@
  // ID of the backend
  private static final String backendId = "replicationChanges";
  // At startup, the listen thread wait on this flag for the connet
  // thread to look for other servers in the topology.
  // TODO when a replication server is out of date (has old changes
  // to receive from other servers, the listen thread should not accept
  // connection from ldap servers. (issue 1302)
  private boolean connectedInTopology = false;
  private final Object connectedInTopologyLock = new Object();
  /**
   * The tracer object for the debug logger.
   */
@@ -211,6 +219,23 @@
  void runListen()
  {
    Socket newSocket;
    // wait for the connect thread to find other replication
    // servers in the topology before starting to accept connections
    // from the ldap servers.
    synchronized (connectedInTopologyLock)
    {
      if (connectedInTopology == false)
      {
        try
        {
          connectedInTopologyLock.wait(1000);
        } catch (InterruptedException e)
        {
        }
      }
    }
    while ((shutdown == false) && (stopListen  == false))
    {
      // Wait on the replicationServer port.
@@ -286,6 +311,15 @@
          }
        }
      }
      synchronized (connectedInTopologyLock)
      {
        // wake up the listen thread if necessary.
        if (connectedInTopology == false)
        {
          connectedInTopologyLock.notify();
          connectedInTopology = true;
        }
      }
      try
      {
        synchronized (this)
@@ -391,7 +425,7 @@
      // FIXME : Is it better to have the time to receive the ReplServerInfo
      // from all the other replication servers since this info is necessary
      // to route an early received total update request.
      try { Thread.sleep(300);} catch(Exception e) {}
      if (debugEnabled())
        TRACER.debugInfo("RS " +getMonitorInstanceName()+
            " creates listen threads");
@@ -798,6 +832,7 @@
        // Add the replication backend
        DirectoryServer.getConfigHandler().addEntry(backendConfigEntry, null);
      }
      ldifImportConfig.close();
    }
    catch(Exception e)
    {