You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by rv...@apache.org on 2013/01/29 13:42:32 UTC
svn commit: r1439864 -
/jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/PipedRDFIterator.java
Author: rvesse
Date: Tue Jan 29 12:42:32 2013
New Revision: 1439864
URL: http://svn.apache.org/viewvc?rev=1439864&view=rev
Log:
Add a separate finished flag to PipedRDFIterator which is set when the end marker is seen, if this is set hasNext() returns false.
This is necessary because setting closedByReader (as was previously done and I removed already) caused hasNext() to throw a spurious exception if the caller invoked hasNext() multiple times. Setting a separate flag allows us to properly return false
Modified:
jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/PipedRDFIterator.java
Modified: jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/PipedRDFIterator.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/PipedRDFIterator.java?rev=1439864&r1=1439863&r2=1439864&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/PipedRDFIterator.java (original)
+++ jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/PipedRDFIterator.java Tue Jan 29 12:42:32 2013
@@ -64,6 +64,7 @@ public class PipedRDFIterator<T> impleme
private volatile boolean closedByReader = false ;
private volatile boolean closedByWriter = false ;
+ private volatile boolean finished = false;
private volatile Thread readSide ;
private volatile Thread writeSide ;
@@ -146,6 +147,9 @@ public class PipedRDFIterator<T> impleme
if (closedByReader)
throw new RiotException("Pipe closed");
+ if (finished)
+ return false;
+
readSide = Thread.currentThread();
if (slot != null)
@@ -176,6 +180,7 @@ public class PipedRDFIterator<T> impleme
// When the end marker is seen set slot to null
if (slot == endMarker)
{
+ finished = true;
slot = null ;
return false ;
}