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

Jean-Noel Rouvignac
17.47.2014 eaa95348ed85ad3d9909e8e703bdeae31a48e0ab
opendj3-server-dev/src/server/org/opends/server/backends/pluggable/DatabaseContainer.java
@@ -83,7 +83,7 @@
    txn.openTree(treeName);
    if (logger.isTraceEnabled())
    {
      logger.trace("JE database %s opened. txnid=%d", treeName, txn.getId());
      logger.trace("JE database %s opened. txn=%s", treeName, txn);
    }
  }
@@ -105,11 +105,7 @@
  @Override
  public synchronized void close() throws StorageRuntimeException
  {
    if(dbConfig.getDeferredWrite())
    {
      treeName.sync();
    }
    treeName.close();
    storage.closeTree(treeName);
    treeName = null;
    if(logger.isTraceEnabled())
@@ -213,7 +209,7 @@
   */
  public long getRecordCount(ReadableStorage txn) throws StorageRuntimeException
  {
    long count = treeName.count();
    long count = count(txn);
    if (logger.isTraceEnabled())
    {
      logger.trace(messageToLog(true, treeName, null, null, null));
@@ -221,6 +217,24 @@
    return count;
  }
  private long count(ReadableStorage txn)
  {
    final Cursor cursor = txn.openCursor(treeName);
    try
    {
      long count = 0;
      while (cursor.next())
      {
        count++;
      }
      return count;
    }
    finally
    {
      cursor.close();
    }
  }
  /**
   * Get a string representation of this object.
   * @return return A string representation of this object.
@@ -242,20 +256,6 @@
  }
  /**
   * Preload the database into cache.
   *
   * @param config The preload configuration.
   * @return Statistics about the preload process.
   * @throws StorageRuntimeException If an JE database error occurs
   * during the preload.
   */
  public PreloadStats preload(PreloadConfig config)
      throws StorageRuntimeException
  {
    return treeName.preload(config);
  }
  /**
   * Set the JE database name to use for this container.
   *
   * @param name The database name to use for this container.
@@ -277,15 +277,8 @@
    builder.append(treeName);
    if (txn != null)
    {
      builder.append(" txnid=");
      try
      {
        builder.append(txn.getId());
      }
      catch (StorageRuntimeException de)
      {
        builder.append(de);
      }
      builder.append(" txn=");
      builder.append(txn);
    }
    else
    {