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

boli
01.27.2007 455897cc245b67d929f409a93cfa7106e835cc1f
opends/src/server/org/opends/server/loggers/TimeLimitRotationPolicy.java
@@ -22,22 +22,18 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2006 Sun Microsystems, Inc.
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 */
package org.opends.server.loggers;
import org.opends.server.util.TimeThread;
import static org.opends.server.loggers.Debug.*;
/**
 * This class implements a fixed time based rotation policy.
 * Rotation will happen N seconds since the last rotation.
 */
public class TimeLimitRotationPolicy implements RotationPolicy
{
  private static final String CLASS_NAME =
      "org.opends.server.loggers.TimeLimitRotationPolicy";
  private long timeInterval = 0;
  private long lastModifiedTime = 0;
@@ -49,7 +45,7 @@
   */
  public TimeLimitRotationPolicy(long time)
  {
    assert debugConstructor(CLASS_NAME, String.valueOf(time));
    timeInterval = time;
    lastModifiedTime = TimeThread.getTime();
  }
@@ -63,14 +59,15 @@
   */
  public boolean rotateFile()
  {
    assert debugEnter(CLASS_NAME, "rotateFile");
    long currTime = TimeThread.getTime();
    if(currTime - lastModifiedTime > timeInterval)
    if (currTime - lastModifiedTime > timeInterval)
    {
      do
      {
        lastModifiedTime += timeInterval;
      } while (lastModifiedTime < currTime);
      }
      while (lastModifiedTime < currTime);
      // lastModifiedTime = currTime;
      return true;