{
Message message = ERR_JEB_IMPORT_LDIF_READER_IO_ERROR.get();
throw new InitializationException(message, ioe);
}
DiskSpaceMonitor tmpMonitor = new DiskSpaceMonitor(
backendConfiguration.getBackendId() + " backend import tmp directory",
tempDir, backendConfiguration.getDiskLowThreshold(),
backendConfiguration.getDiskFullThreshold(), 5,
TimeUnit.SECONDS, this);
tmpMonitor.initializeMonitorProvider(null);
DirectoryServer.registerMonitorProvider(tmpMonitor);
File parentDirectory =
getFileForPath(backendConfiguration.getDBDirectory());
File backendDirectory =
new File(parentDirectory, backendConfiguration.getBackendId());
DiskSpaceMonitor dbMonitor = new DiskSpaceMonitor(
backendConfiguration.getBackendId() + " backend import DB directory",
backendDirectory, backendConfiguration.getDiskLowThreshold(),
backendConfiguration.getDiskFullThreshold(), 5,
TimeUnit.SECONDS, this);
dbMonitor.initializeMonitorProvider(null);
DirectoryServer.registerMonitorProvider(dbMonitor);
try
{
Message message = NOTE_JEB_IMPORT_STARTING.get(
DirectoryServer.getVersionString(), BUILD_ID, REVISION_NUMBER);
logError(message);
message = NOTE_JEB_IMPORT_THREAD_COUNT.get(threadCount);
logError(message);
initializeSuffixes();
setIndexesTrusted(false);
long startTime = System.currentTimeMillis();
phaseOne();
isPhaseOneDone = true;
long phaseOneFinishTime = System.currentTimeMillis();
if (!skipDNValidation)
{
tmpEnv.shutdown();
}
if (isCanceled)
{
throw new InterruptedException("Import processing canceled.");
}
long phaseTwoTime = System.currentTimeMillis();
phaseTwo();
if (isCanceled)
{
throw new InterruptedException("Import processing canceled.");
}
long phaseTwoFinishTime = System.currentTimeMillis();
setIndexesTrusted(true);
switchContainers();
recursiveDelete(tempDir);
long finishTime = System.currentTimeMillis();
long importTime = (finishTime - startTime);
float rate = 0;
message = NOTE_JEB_IMPORT_PHASE_STATS.get(importTime / 1000,
(phaseOneFinishTime - startTime) / 1000,
(phaseTwoFinishTime - phaseTwoTime) / 1000);
logError(message);
if (importTime > 0) rate = 1000f * reader.getEntriesRead() / importTime;
message = NOTE_JEB_IMPORT_FINAL_STATUS.get(reader.getEntriesRead(),
importCount.get(), reader.getEntriesIgnored(),
reader.getEntriesRejected(), migratedCount, importTime / 1000, rate);
logError(message);
}
finally
{
reader.close();
DirectoryServer.deregisterMonitorProvider(
tmpMonitor.getMonitorInstanceName());
DirectoryServer.deregisterMonitorProvider(
dbMonitor.getMonitorInstanceName());
tmpMonitor.finalizeMonitorProvider();
dbMonitor.finalizeMonitorProvider();
}
return new LDIFImportResult(reader.getEntriesRead(),
reader.getEntriesRejected(), reader.getEntriesIgnored());
}