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

Jean-Noel Rouvignac
10.31.2013 700dffb800fea545d109919f59d168f09b37c05e
opends/src/server/org/opends/server/replication/server/changelog/je/JEChangeNumberIndexDB.java
@@ -32,7 +32,6 @@
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.locks.ReentrantLock;
import org.opends.messages.MessageBuilder;
import org.opends.server.admin.std.server.MonitorProviderCfg;
@@ -220,24 +219,6 @@
    return getNewestRecord() == null;
  }
  /**
   * Get a read cursor on the database from a provided key. The cursor MUST be
   * closed after use.
   * <p>
   * This method is only used by unit tests.
   *
   * @param startChangeNumber
   *          The change number from where to start.
   * @return the new cursor.
   * @throws ChangelogException
   *           if a database problem occurs.
   */
  DraftCNDBCursor getReadCursor(long startChangeNumber)
      throws ChangelogException
  {
    return db.openReadCursor(startChangeNumber);
  }
  /** {@inheritDoc} */
  @Override
  public DBCursor<CNIndexRecord> getCursorFrom(long startChangeNumber)
@@ -564,49 +545,4 @@
    newestChangeNumber = getChangeNumber(db.readLastRecord());
  }
  private ReentrantLock lock = new ReentrantLock();
  /**
   * Tests if the current thread has the lock on this object.
   * @return True if the current thread has the lock.
   */
  public boolean hasLock()
  {
    return lock.getHoldCount() > 0;
  }
  /**
   * Takes the lock on this object (blocking until lock can be acquired).
   * @throws InterruptedException If interrupted.
   */
  public void lock() throws InterruptedException
  {
    lock.lockInterruptibly();
  }
  /**
   * Releases the lock on this object.
   */
  public void release()
  {
    lock.unlock();
  }
  /** {@inheritDoc} */
  @Override
  public CNIndexRecord getRecord(long changeNumber)
      throws ChangelogException
  {
    DraftCNDBCursor cursor = null;
    try
    {
      cursor = db.openReadCursor(changeNumber);
      return cursor.currentRecord();
    }
    finally
    {
      close(cursor);
    }
  }
}