| | |
| | | envConfig.setConfigParam("je.log.totalBufferBytes", "30000000"); |
| | | envConfig.setConfigParam("je.log.fileMax", "100000000"); |
| | | */ |
| | | |
| | | // Create an LDIF reader. Throws an exception if the file does not exist. |
| | | reader = new LDIFReader(ldifImportConfig); |
| | | |
| | | int msgID; |
| | | String message; |
| | | long startTime; |
| | | try |
| | | { |
| | | rootContainer = new RootContainer(config, backend); |
| | | if (ldifImportConfig.appendToExistingData()) |
| | | { |
| | |
| | | long bufferSize = config.getImportBufferSize() / |
| | | (importThreadCount*config.getBaseDNs().length); |
| | | |
| | | int msgID = MSGID_JEB_IMPORT_THREAD_COUNT; |
| | | String message = getMessage(msgID, importThreadCount); |
| | | msgID = MSGID_JEB_IMPORT_THREAD_COUNT; |
| | | message = getMessage(msgID, importThreadCount); |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.NOTICE, |
| | | message, msgID); |
| | | |
| | |
| | | importContext.setBufferSize(bufferSize); |
| | | importContext.setConfig(config); |
| | | importContext.setLDIFImportConfig(this.ldifImportConfig); |
| | | importContext.setLDIFReader(reader); |
| | | |
| | | importContext.setBaseDN(baseDN); |
| | | importContext.setContainerName(entryContainer.getContainerName()); |
| | |
| | | } |
| | | |
| | | // Make a note of the time we started. |
| | | long startTime = System.currentTimeMillis(); |
| | | startTime = System.currentTimeMillis(); |
| | | |
| | | try |
| | | { |
| | |
| | | logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.NOTICE, |
| | | message, msgID); |
| | | } |
| | | } |
| | | finally |
| | | { |
| | | reader.close(); |
| | | } |
| | | |
| | | long finishTime = System.currentTimeMillis(); |
| | | long importTime = (finishTime - startTime); |
| | |
| | | } |
| | | |
| | | /** |
| | | * Open a reader for the LDIF file and create a set of worker threads, one |
| | | * set for each base DN. Read each entry from the LDIF and determine which |
| | | * Create a set of worker threads, one set for each base DN. |
| | | * Read each entry from the LDIF and determine which |
| | | * base DN the entry belongs to. Write the dn2id database, then put the |
| | | * entry on the appropriate queue for the worker threads to consume. |
| | | * Record the entry count for each base DN when all entries have been |
| | | * processed. |
| | | * |
| | | * @return true if is more data to be read from the LDIF file (the import |
| | | * @return true if thre is more data to be read from the LDIF file (the import |
| | | * pass size was reached), false if the entire LDIF file has been read. |
| | | * |
| | | * @throws JebException If an error occurs in the JE backend. |
| | |
| | | { |
| | | boolean moreData = false; |
| | | |
| | | // Create an LDIF reader if necessary. |
| | | if (reader == null) |
| | | { |
| | | reader = new LDIFReader(ldifImportConfig); |
| | | for (ImportContext ic : importMap.values()) |
| | | { |
| | | ic.setLDIFReader(reader); |
| | | } |
| | | } |
| | | |
| | | ArrayList<ImportThread> threads; |
| | | try |
| | | { |
| | | |
| | | // Create one set of worker threads for each base DN. |
| | | int importThreadCount = config.getImportThreadCount(); |
| | | threads = new ArrayList<ImportThread>(importThreadCount*importMap.size()); |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | finally |
| | | { |
| | | if (! moreData) |
| | | { |
| | | reader.close(); |
| | | } |
| | | } |
| | | |
| | | |
| | | return moreData; |