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

Jean-Noël Rouvignac
01.02.2015 1ab173bb3536182a1eb40f49e59c44bc030d649b
opendj-server-legacy/src/main/java/org/opends/server/loggers/TextAuditLogPublisher.java
@@ -82,9 +82,19 @@
        if (config.isAsynchronous())
        {
          if (!(writer instanceof AsynchronousTextWriter))
          if (writer instanceof AsynchronousTextWriter)
          {
            // The asynchronous setting is being turned on.
            if (hasAsyncConfigChanged(config))
            {
              // reinstantiate
              final AsynchronousTextWriter previousWriter = (AsynchronousTextWriter) writer;
              writer = newAsyncWriter(mfWriter, config);
              previousWriter.shutdown(false);
            }
          }
          else
          {
            // turn async text writer on
            writer = newAsyncWriter(mfWriter, config);
          }
        }
@@ -92,10 +102,10 @@
        {
          if (writer instanceof AsynchronousTextWriter)
          {
            // The asynchronous setting is being turned off.
            AsynchronousTextWriter asyncWriter = (AsynchronousTextWriter) writer;
            // asynchronous is being turned off, remove async text writers.
            final AsynchronousTextWriter previousWriter = (AsynchronousTextWriter) writer;
            writer = mfWriter;
            asyncWriter.shutdown(false);
            previousWriter.shutdown(false);
          }
        }
@@ -150,6 +160,13 @@
    return getFileForPath(config.getLogFile());
  }
  private boolean hasAsyncConfigChanged(FileBasedAuditLogPublisherCfg newConfig)
  {
    return !cfg.dn().equals(newConfig.dn())
        && cfg.isAutoFlush() != newConfig.isAutoFlush()
        && cfg.getQueueSize() != newConfig.getQueueSize();
  }
  @Override
  protected void close0()
  {