Commit ddb02fdd authored by David Novak's avatar David Novak
Browse files

* fixed not unlocking PPP-Tree node in one branch of code in SingleSpaceCandGeneratorAsync

 * version increased
parent fc2df253
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@

    <groupId>mindex</groupId>
    <artifactId>ppp-codes</artifactId>
    <version>1.2.4-DEVEL</version>
    <version>1.2.5-DEVEL</version>
    <packaging>jar</packaging>

    <name>ppp-codes</name>
+1 −1
Original line number Diff line number Diff line
@@ -110,7 +110,7 @@ public abstract class ApproxNavProcessorPPPCodes implements AsynchronousNavigati
            return new Callable<RankingSingleQueryOperation>() {
                @Override
                public RankingSingleQueryOperation call() throws InterruptedException, CloneNotSupportedException, AlgorithmMethodException {
                    // the single navigation processor CANNOT be executed in threads
                    // the single navigation processor CANNOT be executed in threads (that is why pass 'null' to the .execute method)
                    NavigationProcessors.execute(null, processor);
                    return originalOperation;
                }
+13 −0
Original line number Diff line number Diff line
@@ -56,6 +56,14 @@ public class SingleSpaceCandGeneratorAsync extends SingleSpaceCandGenerator {
        objectCache = new ArrayBlockingQueue<>(CACHE_SIZE);
    }  

    /**
     * This method reads from the priority queue {@link #priorityQueue} next leaf node of the PPP-Tree. 
     *   The underlying {@link ApproxNavigationProcessor} processes any internal nodes that would be on the top of the
     *   priority queue. If data objects (object IDs, instances of {@link RankableLocators}) are at the top of the queue, 
     *   they are moved to the cache {@link #objectCache}.
     * @param isAsynchronous flag, if the processing of this processor is realized in threads (it should not be in case of this class)
     * @return leaf cell or null, if the reading is finished (the PPP-Codes merging thread has finished)
     */
    @Override
    protected RankableCell getNextProcessingItem(boolean isAsynchronous) {
        RankableCell retVal = null;
@@ -63,6 +71,7 @@ public class SingleSpaceCandGeneratorAsync extends SingleSpaceCandGenerator {
            moveFromQueueToCache();
        }
        if (readingFinished) {
            retVal.getCell().readUnLock();
            return null;
        }
        return retVal;
@@ -82,6 +91,10 @@ public class SingleSpaceCandGeneratorAsync extends SingleSpaceCandGenerator {
        }
    }    
    
    /**
     * 
     * @throws NoSuchElementException 
     */
    private void moveFromQueueToCache() throws NoSuchElementException {
        while (! priorityQueue.isEmpty() && (priorityQueue.peek() instanceof RankableLocators) && !readingFinished) {            
            try {