| | |
| | | availableMemory = totalAvailableMemory * importMemPct / 100; |
| | | } |
| | | |
| | | private boolean isCanceled() |
| | | { |
| | | return isCanceled || (importCfg != null && importCfg.isCancelled()); |
| | | } |
| | | |
| | | private void initializeIndexBuffers() |
| | | { |
| | | for (int i = 0; i < phaseOneBufferCount; i++) |
| | |
| | | dnCache.close(); |
| | | } |
| | | |
| | | if (isCanceled) |
| | | if (isCanceled()) |
| | | { |
| | | throw new InterruptedException("Import processing canceled."); |
| | | } |
| | | |
| | | final long phaseTwoTime = System.currentTimeMillis(); |
| | | importPhaseTwo(); |
| | | if (isCanceled) |
| | | if (isCanceled()) |
| | | { |
| | | throw new InterruptedException("Import processing canceled."); |
| | | } |
| | |
| | | ByteStringBuilder end = afterKey(key); |
| | | |
| | | while (success |
| | | && ByteSequence.COMPARATOR.compare(key, end) < 0 |
| | | && !importCfg.isCancelled() |
| | | && !isCanceled) |
| | | && key.compareTo(end) < 0 |
| | | && !isCanceled()) |
| | | { |
| | | EntryID id = new EntryID(cursor.getValue()); |
| | | Entry entry = entryContainer.getID2Entry().get(txn, id); |
| | |
| | | final List<ByteString> includeBranches = includeBranchesAsBytes(suffix); |
| | | boolean success = cursor.next(); |
| | | while (success |
| | | && !importCfg.isCancelled() |
| | | && !isCanceled) |
| | | && !isCanceled()) |
| | | { |
| | | final ByteString key = cursor.getKey(); |
| | | if (!includeBranches.contains(key)) |
| | |
| | | EntryInformation entryInfo; |
| | | while ((entryInfo = reader.readEntry(dnSuffixMap)) != null) |
| | | { |
| | | if (importCfg.isCancelled() || isCanceled) |
| | | if (isCanceled()) |
| | | { |
| | | freeBufferQueue.add(IndexOutputBuffer.poison()); |
| | | return; |
| | |
| | | EntryInformation entryInfo; |
| | | while ((entryInfo = reader.readEntry(dnSuffixMap)) != null) |
| | | { |
| | | if (importCfg.isCancelled() || isCanceled) |
| | | if (isCanceled()) |
| | | { |
| | | freeBufferQueue.add(IndexOutputBuffer.poison()); |
| | | return; |
| | |
| | | dnState.finalFlush(importer); |
| | | } |
| | | |
| | | if (!isCanceled) |
| | | if (!isCanceled()) |
| | | { |
| | | logger.info(NOTE_IMPORT_LDIF_DN_CLOSE, indexMgr.getDNCount()); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (!isCanceled) |
| | | if (!isCanceled()) |
| | | { |
| | | logger.info(NOTE_IMPORT_LDIF_INDEX_CLOSE, indexMgr.getBufferFileName()); |
| | | } |
| | |
| | | |
| | | private void call0(Importer importer) throws Exception |
| | | { |
| | | if (isCanceled) |
| | | if (isCanceled()) |
| | | { |
| | | return; |
| | | } |
| | |
| | | NavigableSet<IndexInputBuffer> bufferSet; |
| | | while ((bufferSet = getNextBufferBatch()) != null) |
| | | { |
| | | if (isCanceled) |
| | | if (isCanceled()) |
| | | { |
| | | return; |
| | | } |
| | |
| | | @Override |
| | | public Void call() throws Exception |
| | | { |
| | | if ((importCfg != null && importCfg.isCancelled()) |
| | | || isCanceled) |
| | | if (isCanceled()) |
| | | { |
| | | isCanceled = true; |
| | | return null; |
| | |
| | | { |
| | | while (cursor.next()) |
| | | { |
| | | if (isCanceled) |
| | | if (isCanceled()) |
| | | { |
| | | return; |
| | | } |
| | |
| | | |
| | | private void throwIfCancelled() throws InterruptedException |
| | | { |
| | | if (isCanceled) |
| | | if (isCanceled()) |
| | | { |
| | | throw new InterruptedException("Rebuild Index canceled."); |
| | | } |