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

dugan
12.37.2008 7294e5c0f8655e64353858e506c385efa8fc4e9e
opends/src/server/org/opends/server/backends/jeb/importLDIF/Importer.java
@@ -138,15 +138,20 @@
  //A thread threw an Runtime exception stop the import.
  private boolean unCaughtExceptionThrown = false;
  //Set to true if substring indexes are defined.
  private boolean hasSubIndexes = false;
  /**
   * Create a new import job with the specified ldif import config.
   *
   * @param ldifImportConfig The LDIF import config.
   * @param hasSubIndexes <CODE>True</CODE> If substring indexes are defined.
   */
  public Importer(LDIFImportConfig ldifImportConfig)
  public Importer(LDIFImportConfig ldifImportConfig, boolean hasSubIndexes)
  {
    this.ldifImportConfig = ldifImportConfig;
    this.threads = new CopyOnWriteArrayList<WorkThread>();
    this.hasSubIndexes = hasSubIndexes;
    calcMemoryLimits();
  }
@@ -172,12 +177,12 @@
    }
    // Create one set of worker threads/buffer managers for each base DN.
    for (DNContext context : importMap.values()) {
      BufferManager bufferManager = new BufferManager(memoryPerContext,
                                                      importThreadCount);
      BufferManager bufferManager =
                        new BufferManager(memoryPerContext, importThreadCount);
      context.setBufferManager(bufferManager);
      for (int i = 0; i < importThreadCount; i++) {
        WorkThread t = new WorkThread(context.getWorkQueue(), i,
                                      bufferManager, rootContainer);
                bufferManager, rootContainer);
        t.setUncaughtExceptionHandler(this);
        threads.add(t);
        t.start();
@@ -771,7 +776,12 @@
    long maxMemory = runtime.maxMemory();
    long totMemory = runtime.totalMemory();
    long totFreeMemory = (freeMemory + (maxMemory - totMemory));
    long dbCacheLimit = (totFreeMemory * 40) / 100;
    long dbCacheLimit = (totFreeMemory * 45) / 100;
    //If there are now substring indexes defined, set the DB cache
    //size to 60% and take a minimal substring buffer.
    if(!hasSubIndexes) {
      dbCacheLimit = (totFreeMemory * 60) / 100;
    }
    dbCacheSizeStr = Long.toString(dbCacheLimit);
    totalAvailBufferMemory = (totFreeMemory * 10) / 100;
    if(totalAvailBufferMemory < (10 * minBuffer)) {
@@ -780,6 +790,8 @@
                                                      (10 * minBuffer));
      logError(msg);
      totalAvailBufferMemory = (10 * minBuffer);
    } else if(!hasSubIndexes) {
      totalAvailBufferMemory = (10 * minBuffer);
    }
    msg=NOTE_JEB_IMPORT_LDIF_MEMORY_INFO.get(dbCacheLimit,
                                             totalAvailBufferMemory);