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

pgamba
22.21.2009 b677ba1f966ac76de8a3dccd35c5a4186a03c18a
Partial fix of #4312 Remove unnessary IOException messages when handler is stopping
2 files modified
81 ■■■■ changed files
opends/src/server/org/opends/server/replication/server/ReplicationServerDomain.java 72 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/ServerHandler.java 9 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/server/ReplicationServerDomain.java
@@ -1812,24 +1812,37 @@
  {
    for (DataServerHandler handler : directoryServers.values())
    {
      if (handler.getStatus() != ServerStatus.NOT_CONNECTED_STATUS)
      {
        if ((notThisOne == null) || // All DSs requested
      if ((notThisOne == null) || // All DSs requested
          ((notThisOne != null) && (handler != notThisOne)))
        // All except passed one
      {
        for (int i=1; i<2; i++)
        {
          TopologyMsg topoMsg = createTopologyMsgForDS(handler.getServerId());
          try
          if (handler.shuttingDown()==false)
          {
            handler.sendTopoInfo(topoMsg);
          } catch (IOException e)
          {
            Message message = ERR_EXCEPTION_SENDING_TOPO_INFO.get(
            baseDn.toString(),
            "directory", Integer.toString(handler.getServerId()),
            e.getMessage());
            logError(message);
            if (handler.getStatus() != ServerStatus.NOT_CONNECTED_STATUS)
            {
              TopologyMsg topoMsg=createTopologyMsgForDS(handler.getServerId());
              try
              {
                handler.sendTopoInfo(topoMsg);
                break;
              }
              catch (IOException e)
              {
                if (i==2)
                {
                  Message message = ERR_EXCEPTION_SENDING_TOPO_INFO.get(
                      baseDn.toString(),
                      "directory",
                      Integer.toString(handler.getServerId()),
                      e.getMessage());
                  logError(message);
                }
              }
            }
          }
          try { Thread.sleep(100); } catch(Exception e) {}
        }
      }
    }
@@ -1844,19 +1857,32 @@
    TopologyMsg topoMsg = createTopologyMsgForRS();
    for (ReplicationServerHandler handler : replicationServers.values())
    {
      if (handler.getStatus() != ServerStatus.NOT_CONNECTED_STATUS)
      for (int i=1; i<2; i++)
      {
        try
        if (handler.shuttingDown()==false)
        {
          handler.sendTopoInfo(topoMsg);
        } catch (IOException e)
        {
          Message message = ERR_EXCEPTION_SENDING_TOPO_INFO.get(
            baseDn.toString(),
            "replication", Integer.toString(handler.getServerId()),
            e.getMessage());
          logError(message);
          if (handler.getStatus() != ServerStatus.NOT_CONNECTED_STATUS)
          {
            try
            {
              handler.sendTopoInfo(topoMsg);
              break;
            }
            catch (IOException e)
            {
              if (i==2)
              {
                Message message = ERR_EXCEPTION_SENDING_TOPO_INFO.get(
                    baseDn.toString(),
                    "replication",
                    Integer.toString(handler.getServerId()),
                    e.getMessage());
                logError(message);
              }
            }
          }
        }
        try { Thread.sleep(100); } catch(Exception e) {}
      }
    }
  }
opends/src/server/org/opends/server/replication/server/ServerHandler.java
@@ -342,6 +342,15 @@
  }
  /**
   * Returns the shutdown flag.
   * @return The shutdown flag value.
   */
  public boolean shuttingDown()
  {
    return shuttingDown.get();
  }
  /**
   * Finalize the initialization, create reader, writer, heartbeat system
   * and monitoring system.
   * @throws DirectoryException When an exception is raised.