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

Nicolas Capponi
11.37.2016 fa6a436d8ae0dd3686f586953a7cacc38a8674c7
opendj-server-legacy/src/main/java/org/opends/server/replication/server/changelog/file/LogFile.java
@@ -103,23 +103,24 @@
    Reject.ifNull(logFilePath, parser);
    this.logfile = logFilePath;
    this.isWriteEnabled = isWriteEnabled;
    final ReadWriteLock rwLock = new ReentrantReadWriteLock();
    exclusiveLock = rwLock.writeLock();
    sharedLock = rwLock.readLock();
    createLogFileIfNotExists();
    readerPool = new LogReaderPool<>(logfile, parser);
    if (isWriteEnabled)
    {
      ensureLogFileIsValid(parser);
      writer = BlockLogWriter.newWriter(new LogWriter(logfile), parser);
      initializeNewestRecord();
    }
    else
    {
      // Newest record is never requested for read-only log files.
      // It will never be because it is available in the file name.
      writer = null;
    }
    readerPool = new LogReaderPool<>(logfile, parser);
    final ReadWriteLock rwLock = new ReentrantReadWriteLock();
    exclusiveLock = rwLock.writeLock();
    sharedLock = rwLock.readLock();
    initializeNewestRecord();
  }
  /**
@@ -408,7 +409,8 @@
    }
    catch (IOException ioe)
    {
      throw new ChangelogException(ERR_CHANGELOG_CANNOT_READ_NEWEST_RECORD.get(logfile.getAbsolutePath()), ioe);
      throw new ChangelogException(ERR_CHANGELOG_CANNOT_READ_NEWEST_RECORD.get(logfile.getAbsolutePath() + "- " +
          StaticUtils.stackTraceToSingleLineString(ioe) + "-" + Thread.currentThread()), ioe);
    }
  }