jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rve...@apache.org
Subject svn commit: r1528489 - in /jena/trunk/jena-arq/src: main/java/org/apache/jena/riot/lang/PipedRDFIterator.java test/java/org/apache/jena/riot/lang/TestPipedRDFIterators.java
Date Wed, 02 Oct 2013 14:22:58 GMT
Author: rvesse
Date: Wed Oct  2 14:22:58 2013
New Revision: 1528489

URL: http://svn.apache.org/r1528489
Log:
Code formatting and renaming within PipedRDFIterator to make the code clearer and explained
in general multi-threading terminology
reader -> consumer
writer -> producer

Modified:
    jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/lang/PipedRDFIterator.java
    jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestPipedRDFIterators.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=1528489&r1=1528488&r2=1528489&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 Wed
Oct  2 14:22:58 2013
@@ -31,17 +31,23 @@ import org.apache.jena.riot.system.Prefi
 import org.apache.jena.riot.system.PrefixMapFactory;
 
 /**
+ * <p>
  * A {@code PipedRDFIterator} should be connected to a {@link PipedRDFStream}
  * implementation; the piped iterator then provides whatever RDF primitives are
- * written to the {@code PipedRDFStream}. Typically, data is read from a
- * {@code PipedRDFIterator} by one thread and data is written to the
- * corresponding {@code PipedRDFStream} by some other thread. Attempting to use
- * both objects from a single thread is not recommended, as it may deadlock the
- * thread. The {@code PipedRDFIterator} contains a buffer, decoupling read
- * operations from write operations, within limits.
- * <p/>
+ * written to the {@code PipedRDFStream}
+ * </p>
+ * <p>
+ * Typically, data is read from a {@code PipedRDFIterator} by one thread (the
+ * consumer) and data is written to the corresponding {@code PipedRDFStream} by
+ * some other thread (the producer). Attempting to use both objects from a
+ * single thread is not recommended, as it may deadlock the thread. The
+ * {@code PipedRDFIterator} contains a buffer, decoupling read operations from
+ * write operations, within limits.
+ * </p>
+ * <p>
  * Inspired by Java's {@link java.io.PipedInputStream} and
  * {@link java.io.PipedOutputStream}
+ * </p>
  * 
  * @param <T>
  *            The type of the RDF primitive, should be one of {@code Triple},
@@ -73,12 +79,12 @@ public class PipedRDFIterator<T> impleme
     @SuppressWarnings("unchecked")
     private final T endMarker = (T) new Object();
 
-    private volatile boolean closedByReader = false;
-    private volatile boolean closedByWriter = false;
+    private volatile boolean closedByConsumer = false;
+    private volatile boolean closedByProducer = false;
     private volatile boolean finished = false;
     private volatile boolean threadReused = false;
-    private volatile Thread readSide;
-    private volatile Thread writeSide;
+    private volatile Thread consumerThread;
+    private volatile Thread producerThread;
 
     private boolean connected = false;
     private int pollTimeout = DEFAULT_POLL_TIMEOUT;
@@ -171,16 +177,16 @@ public class PipedRDFIterator<T> impleme
      * waits for data to be produced. This prevents the consumer thread from
      * blocking indefinitely and allows it to detect various potential deadlock
      * conditions e.g. dead producer thread, another consumer closed the
-     * iterator etc. and errors out accordingly. It is unlikely that you will ever
-     * need to adjust this from the default value provided by
+     * iterator etc. and errors out accordingly. It is unlikely that you will
+     * ever need to adjust this from the default value provided by
      * {@link #DEFAULT_POLL_TIMEOUT}.
      * </p>
      * <p>
      * The {@code maxPolls} parameter controls how many poll attempts will be
      * made by a single consumer thread within the context of a single call to
      * {@link #hasNext()} before the iterator declares the producer to be dead
-     * and errors out accordingly. You may need to adjust this if you have a slow
-     * producer thread or many consumer threads.
+     * and errors out accordingly. You may need to adjust this if you have a
+     * slow producer thread or many consumer threads.
      * </p>
      * 
      * @param bufferSize
@@ -207,27 +213,27 @@ public class PipedRDFIterator<T> impleme
         if (!connected)
             throw new IllegalStateException("Pipe not connected");
 
-        if (closedByReader)
+        if (closedByConsumer)
             throw new RiotException("Pipe closed");
 
         if (finished)
             return false;
 
-        readSide = Thread.currentThread();
+        consumerThread = Thread.currentThread();
 
-        // Depending on how code schedules the threads involved there is a
-        // scenario that exists where a writer can finish/die before the reader
-        // is started and the reader is scheduled onto the same thread thus
-        // resulting in a deadlock on the consumer because it will never be able
-        // to detect that the writer died
+        // Depending on how code and/or the JVM schedules the threads involved
+        // there is a scenario that exists where a producer can finish/die
+        // before theconsumer is started and the consumer is scheduled onto the
+        // same thread thus resulting in a deadlock on the consumer because it
+        // will never be able to detect that the producer died
         // In this scenario we need to set a special flag to indicate the
         // possibility
-        if (writeSide != null && writeSide == readSide)
+        if (producerThread != null && producerThread == consumerThread)
             threadReused = true;
 
         if (slot != null)
             return true;
-        
+
         int attempts = 0;
         while (true) {
             attempts++;
@@ -244,25 +250,26 @@ public class PipedRDFIterator<T> impleme
             // declare this pipe to be "broken"
             // Since check is after the break, we will drain as much as possible
             // out of the queue before throwing this exception
-            if (threadReused || (writeSide != null && !writeSide.isAlive() &&
!closedByWriter)) {
-                closedByReader = true;
-                throw new RiotException("Write end dead");
+            if (threadReused || (producerThread != null && !producerThread.isAlive()
&& !closedByProducer)) {
+                closedByConsumer = true;
+                throw new RiotException("Producer dead");
             }
 
             // Need to check this inside the loop as otherwise outside code that
             // attempts to break the deadlock by causing close() on the iterator
             // cannot do so
-            if (closedByReader)
+            if (closedByConsumer)
                 throw new RiotException("Pipe closed");
-            
+
             // Need to check whether polling attempts have been exceeded
-            // If so declare the writer dead and exit
+            // If so declare the producer dead and exit
             if (attempts >= this.maxPolls) {
-                closedByReader = true;
-                if (writeSide != null) {
-                    throw new RiotException("Write end failed to produce any data within
the specified number of polling attempts, declaring write end dead");
+                closedByConsumer = true;
+                if (producerThread != null) {
+                    throw new RiotException(
+                            "Producer failed to produce any data within the specified number
of polling attempts, declaring producer dead");
                 } else {
-                    throw new RiotException("Write end failed to ever call start(), declaring
write end dead");
+                    throw new RiotException("Producer failed to ever call start(), declaring
producer dead");
                 }
             }
         }
@@ -291,10 +298,10 @@ public class PipedRDFIterator<T> impleme
     }
 
     private void checkStateForReceive() {
-        if (closedByWriter || closedByReader) {
+        if (closedByProducer || closedByConsumer) {
             throw new RiotException("Pipe closed");
-        } else if (readSide != null && !readSide.isAlive()) {
-            throw new RiotException("Read end dead");
+        } else if (consumerThread != null && !consumerThread.isAlive()) {
+            throw new RiotException("Consumer dead");
         }
     }
 
@@ -304,7 +311,7 @@ public class PipedRDFIterator<T> impleme
 
     protected void receive(T t) {
         checkStateForReceive();
-        writeSide = Thread.currentThread();
+        producerThread = Thread.currentThread();
 
         try {
             queue.put(t);
@@ -348,21 +355,36 @@ public class PipedRDFIterator<T> impleme
         }
     }
 
+    /**
+     * Should be called by the producer when it begins writing to the iterator.
+     * If the producer fails to call this for whatever reason and never produces
+     * any output or calls {@code finish()} consumers may be blocked for a short
+     * period before they detect this state and error out.
+     */
     protected void start() {
-        // Track the writer thread in case it never delivers us anything and
+        // Track the producer thread in case it never delivers us anything and
         // dies before calling finish
-        writeSide = Thread.currentThread();
+        producerThread = Thread.currentThread();
     }
 
-    // Called by the producer
+    /**
+     * Should be called by the producer when it has finished writing to the
+     * iterator. If the producer fails to call this for whatever reason
+     * consumers may be blocked for a short period before they detect this state
+     * and error out.
+     */
     protected void finish() {
         receive(endMarker);
-        closedByWriter = true;
+        closedByProducer = true;
     }
 
-    // Called by the consumer
+    /**
+     * May be called by the consumer when it is finished reading from the
+     * iterator, if the producer thread has not finished it will receive an
+     * error the next time it tries to write to the iterator
+     */
     @Override
     public void close() {
-        closedByReader = true;
+        closedByConsumer = true;
     }
 }

Modified: jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestPipedRDFIterators.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestPipedRDFIterators.java?rev=1528489&r1=1528488&r2=1528489&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestPipedRDFIterators.java
(original)
+++ jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/lang/TestPipedRDFIterators.java
Wed Oct  2 14:22:58 2013
@@ -18,32 +18,32 @@
 
 package org.apache.jena.riot.lang;
 
-import java.io.ByteArrayInputStream ;
-import java.nio.charset.Charset ;
-import java.util.concurrent.Callable ;
-import java.util.concurrent.ExecutionException ;
-import java.util.concurrent.ExecutorService ;
-import java.util.concurrent.Executors ;
-import java.util.concurrent.Future ;
-import java.util.concurrent.TimeUnit ;
-import java.util.concurrent.TimeoutException ;
-
-import org.junit.Assert ;
-
-import org.apache.jena.atlas.lib.Tuple ;
-import org.apache.jena.riot.RDFDataMgr ;
-import org.apache.jena.riot.RDFLanguages ;
-import org.apache.jena.riot.RiotException ;
-import org.junit.AfterClass ;
-import org.junit.BeforeClass ;
-import org.junit.Test ;
-import org.slf4j.Logger ;
-import org.slf4j.LoggerFactory ;
-
-import com.hp.hpl.jena.graph.Node ;
-import com.hp.hpl.jena.graph.Triple ;
-import com.hp.hpl.jena.sparql.core.Quad ;
-import com.hp.hpl.jena.sparql.util.NodeFactoryExtra ;
+import java.io.ByteArrayInputStream;
+import java.nio.charset.Charset;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+import org.junit.Assert;
+
+import org.apache.jena.atlas.lib.Tuple;
+import org.apache.jena.riot.RDFDataMgr;
+import org.apache.jena.riot.RDFLanguages;
+import org.apache.jena.riot.RiotException;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.hp.hpl.jena.graph.Node;
+import com.hp.hpl.jena.graph.Triple;
+import com.hp.hpl.jena.sparql.core.Quad;
+import com.hp.hpl.jena.sparql.util.NodeFactoryExtra;
 
 /**
  * Tests for the {@link PipedRDFIterator} implementation
@@ -77,7 +77,7 @@ public class TestPipedRDFIterators {
 
     private void test_streamed_triples(int bufferSize, final int generateSize, boolean fair)
throws InterruptedException,
             ExecutionException, TimeoutException {
-        
+
         final PipedRDFIterator<Triple> it = new PipedRDFIterator<Triple>(bufferSize,
fair);
         final PipedTriplesStream out = new PipedTriplesStream(it);
 
@@ -89,7 +89,8 @@ public class TestPipedRDFIterators {
                 out.start();
                 // Generate triples
                 for (int i = 1; i <= generateSize; i++) {
-                    Triple t = new Triple(com.hp.hpl.jena.graph.NodeFactory.createAnon(),
com.hp.hpl.jena.graph.NodeFactory.createURI("http://predicate"), NodeFactoryExtra.intToNode(i));
+                    Triple t = new Triple(com.hp.hpl.jena.graph.NodeFactory.createAnon(),
+                            com.hp.hpl.jena.graph.NodeFactory.createURI("http://predicate"),
NodeFactoryExtra.intToNode(i));
                     out.triple(t);
                 }
                 out.finish();
@@ -220,7 +221,7 @@ public class TestPipedRDFIterators {
 
     private void test_streamed_quads(int bufferSize, final int generateSize, boolean fair)
throws InterruptedException,
             ExecutionException, TimeoutException {
-        
+
         final PipedRDFIterator<Quad> it = new PipedRDFIterator<Quad>(bufferSize,
fair);
         final PipedQuadsStream out = new PipedQuadsStream(it);
 
@@ -232,8 +233,9 @@ public class TestPipedRDFIterators {
                 out.start();
                 // Generate quads
                 for (int i = 1; i <= generateSize; i++) {
-                    Quad q = new Quad(com.hp.hpl.jena.graph.NodeFactory.createURI("http://graph"),
com.hp.hpl.jena.graph.NodeFactory.createAnon(), com.hp.hpl.jena.graph.NodeFactory.createURI("http://predicate"),
-                            NodeFactoryExtra.intToNode(i));
+                    Quad q = new Quad(com.hp.hpl.jena.graph.NodeFactory.createURI("http://graph"),
+                            com.hp.hpl.jena.graph.NodeFactory.createAnon(),
+                            com.hp.hpl.jena.graph.NodeFactory.createURI("http://predicate"),
NodeFactoryExtra.intToNode(i));
                     out.quad(q);
                 }
                 out.finish();
@@ -364,10 +366,10 @@ public class TestPipedRDFIterators {
 
     private void test_streamed_tuples(int bufferSize, final int generateSize, boolean fair)
throws InterruptedException,
             ExecutionException, TimeoutException {
-        
+
         final PipedRDFIterator<Tuple<Node>> it = new PipedRDFIterator<Tuple<Node>>();
         final PipedTuplesStream out = new PipedTuplesStream(it);
-        
+
         // Create a runnable that will generate tuples
         Runnable genQuads = new Runnable() {
 
@@ -376,7 +378,8 @@ public class TestPipedRDFIterators {
                 out.start();
                 // Generate tuples
                 for (int i = 1; i <= generateSize; i++) {
-                    Tuple<Node> t = Tuple.create(com.hp.hpl.jena.graph.NodeFactory.createURI("http://graph"),
com.hp.hpl.jena.graph.NodeFactory.createAnon(),
+                    Tuple<Node> t = Tuple.create(com.hp.hpl.jena.graph.NodeFactory.createURI("http://graph"),
+                            com.hp.hpl.jena.graph.NodeFactory.createAnon(),
                             com.hp.hpl.jena.graph.NodeFactory.createURI("http://predicate"),
NodeFactoryExtra.intToNode(i));
                     out.tuple(t);
                 }
@@ -536,7 +539,6 @@ public class TestPipedRDFIterators {
      */
     private void test_streamed_triples_bad(final String data, int expected) throws TimeoutException,
InterruptedException {
 
-        
         final PipedRDFIterator<Triple> it = new PipedRDFIterator<Triple>();
         final PipedTriplesStream out = new PipedTriplesStream(it);
 
@@ -620,7 +622,8 @@ public class TestPipedRDFIterators {
     }
 
     /**
-     * Tests attempting to access the iterator before the stream has been connected
+     * Tests attempting to access the iterator before the stream has been
+     * connected
      */
     @Test(expected = IllegalStateException.class)
     public void streamed_state_bad_01() {
@@ -629,60 +632,62 @@ public class TestPipedRDFIterators {
     }
 
     /**
-     * Tests attempting to access the iterator after the producer dies 
+     * Tests attempting to access the iterator after the producer dies
      */
     @Test(expected = RiotException.class)
     public void streamed_state_bad_02() {
-        
+
         final PipedRDFIterator<Triple> it = new PipedRDFIterator<Triple>();
         final PipedTriplesStream out = new PipedTriplesStream(it);
-        
-        Thread t = new Thread(new Runnable()
-        {
+
+        Thread t = new Thread(new Runnable() {
             @Override
-            public void run()
-            {
+            public void run() {
                 out.start();
-                out.triple(Triple.create(com.hp.hpl.jena.graph.NodeFactory.createURI("urn:s"),
com.hp.hpl.jena.graph.NodeFactory.createURI("urn:p"), com.hp.hpl.jena.graph.NodeFactory.createURI("urn:o")));
+                out.triple(Triple.create(com.hp.hpl.jena.graph.NodeFactory.createURI("urn:s"),
+                        com.hp.hpl.jena.graph.NodeFactory.createURI("urn:p"),
+                        com.hp.hpl.jena.graph.NodeFactory.createURI("urn:o")));
                 throw new RuntimeException("die!");
             }
         });
-        
-        // Because this is a unit test, set an exception handler to suppress the normal printing
of the stacktrace to stderr
-        t.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler()
-        {
+
+        // Because this is a unit test, set an exception handler to suppress the
+        // normal printing of the stacktrace to stderr
+        t.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
             @Override
-            public void uncaughtException(Thread t, Throwable e)
-            {
+            public void uncaughtException(Thread t, Throwable e) {
                 // Do nothing
             }
         });
-        
+
         t.start();
-        
+
         Assert.assertTrue(it.hasNext());
         it.next();
-        
+
         // Should throw a RiotException
         it.hasNext();
     }
-    
+
     /**
-     * Tests a possible deadlock scenario where the producer dies and the consumer is scheduled
onto the same thread preventing the consumer from ever noticing the dead producer 
+     * Tests a possible deadlock scenario where the producer dies and the
+     * consumer is scheduled onto the same thread preventing the consumer from
+     * ever noticing the dead producer
      */
     @Test
     public void streamed_state_bad_03() {
-        
+
         final PipedRDFIterator<Triple> it = new PipedRDFIterator<Triple>();
         final PipedTriplesStream out = new PipedTriplesStream(it);
         ExecutorService executor = Executors.newSingleThreadExecutor();
-        
+
         Runnable producer = new Runnable() {
             @Override
-            public void run()
-            {
+            public void run() {
                 out.start();
-                out.triple(Triple.create(com.hp.hpl.jena.graph.NodeFactory.createURI("urn:s"),
com.hp.hpl.jena.graph.NodeFactory.createURI("urn:p"), com.hp.hpl.jena.graph.NodeFactory.createURI("urn:o")));
+                out.triple(Triple.create(com.hp.hpl.jena.graph.NodeFactory.createURI("urn:s"),
+                        com.hp.hpl.jena.graph.NodeFactory.createURI("urn:p"),
+                        com.hp.hpl.jena.graph.NodeFactory.createURI("urn:o")));
                 throw new RuntimeException("die!");
             }
         };
@@ -697,7 +702,7 @@ public class TestPipedRDFIterators {
                 it.next();
             }
         };
-        
+
         Future<?> f = executor.submit(consumer);
         try {
             f.get(3, TimeUnit.SECONDS);
@@ -714,15 +719,16 @@ public class TestPipedRDFIterators {
             executor.shutdownNow();
         }
     }
-    
+
     /**
-     * Tests a scenario where the producer never sends any data (for whatever reason) but
does remember to clean up after itself by calling finish()
+     * Tests a scenario where the producer never sends any data (for whatever
+     * reason) but does remember to clean up after itself by calling finish()
      */
     @Test
     public void streamed_state_bad_04() {
         final PipedRDFIterator<Triple> iter = new PipedRDFIterator<Triple>();
         final PipedTriplesStream stream = new PipedTriplesStream(iter);
-        
+
         Runnable producer = new Runnable() {
             @Override
             public void run() {
@@ -734,14 +740,14 @@ public class TestPipedRDFIterators {
                 }
             }
         };
-        
+
         Future<?> f = executor.submit(producer);
-        
+
         // Verify that the producer did error as expected
         try {
             f.get(3, TimeUnit.SECONDS);
             Assert.fail("Expected an error");
-        }catch (ExecutionException e) {
+        } catch (ExecutionException e) {
             // Ignore - this is as expected
             Assert.assertTrue(e.getCause() != null);
             Assert.assertTrue(e.getCause() instanceof RuntimeException);
@@ -750,15 +756,16 @@ public class TestPipedRDFIterators {
         } catch (InterruptedException e) {
             Assert.fail("Unexpected interrupt");
         }
-        
+
         Runnable consumer = new Runnable() {
             @Override
             public void run() {
                 iter.hasNext();
             }
         };
-        
-        // Consumer should finish successfully because producer will tell us it finished
even though it errored
+
+        // Consumer should finish successfully because producer will tell us it
+        // finished even though it errored
         f = executor.submit(consumer);
         try {
             Object result = f.get(3, TimeUnit.SECONDS);
@@ -771,7 +778,7 @@ public class TestPipedRDFIterators {
             Assert.fail("An interrupt occurred");
         }
     }
-    
+
     /**
      * Tests a scenario where the producer never ever calls start()/finish()
      */
@@ -779,22 +786,23 @@ public class TestPipedRDFIterators {
     public void streamed_state_bad_05() {
         final PipedRDFIterator<Triple> iter = new PipedRDFIterator<Triple>(1,
false, PipedRDFIterator.DEFAULT_POLL_TIMEOUT, 3);
         final PipedTriplesStream stream = new PipedTriplesStream(iter);
-        
+
         Runnable producer = new Runnable() {
             @Override
             public void run() {
-                // Simply die without ever calling start() or finish() on the stream
+                // Simply die without ever calling start() or finish() on the
+                // stream
                 throw new RuntimeException("die");
             }
         };
-        
+
         Future<?> f = executor.submit(producer);
-        
+
         // Verify that the producer did error as expected
         try {
             f.get(3, TimeUnit.SECONDS);
             Assert.fail("Expected an error");
-        }catch (ExecutionException e) {
+        } catch (ExecutionException e) {
             // Ignore - this is as expected
             Assert.assertTrue(e.getCause() != null);
             Assert.assertTrue(e.getCause() instanceof RuntimeException);
@@ -803,21 +811,23 @@ public class TestPipedRDFIterators {
         } catch (InterruptedException e) {
             Assert.fail("Unexpected interrupt");
         }
-        
+
         Runnable consumer = new Runnable() {
             @Override
             public void run() {
                 iter.hasNext();
             }
         };
-        
-        // Consumer should finish successfully because producer will tell us it finished
even though it errored
+
+        // Consumer should finish successfully because producer will tell us it
+        // finished even though it errored
         f = executor.submit(consumer);
         try {
             Object result = f.get(5, TimeUnit.SECONDS);
             Assert.fail("An error was expected");
         } catch (ExecutionException e) {
-            // Ignore - this is as expected and indicates we successfully detected the bad
state
+            // Ignore - this is as expected and indicates we successfully
+            // detected the bad state
             Assert.assertTrue(e.getCause() != null);
             Assert.assertTrue(e.getCause() instanceof RiotException);
         } catch (TimeoutException e) {
@@ -826,9 +836,10 @@ public class TestPipedRDFIterators {
             Assert.fail("An interrupt occurred");
         }
     }
-    
+
     /**
-     * Check we can safely call hasNext() multiple times after the stream is exhausted
+     * Check we can safely call hasNext() multiple times after the stream is
+     * exhausted
      */
     @Test
     public void streamed_iterator_usage_01() {
@@ -839,11 +850,11 @@ public class TestPipedRDFIterators {
         Assert.assertFalse(iter.hasNext());
         Assert.assertFalse(iter.hasNext());
     }
-    
+
     /**
      * Check that calling hasNext() after a close() is an error
      */
-    @Test(expected=RiotException.class)
+    @Test(expected = RiotException.class)
     public void streamed_iterator_usage_02() {
         PipedRDFIterator<Triple> iter = new PipedRDFIterator<Triple>();
         PipedTriplesStream stream = new PipedTriplesStream(iter);
@@ -851,7 +862,7 @@ public class TestPipedRDFIterators {
         stream.finish();
         Assert.assertFalse(iter.hasNext());
         iter.close();
-        //Should throw an error after the iterator is closed
+        // Should throw an error after the iterator is closed
         iter.hasNext();
     }
 }



Mime
View raw message