Github user afs commented on a diff in the pull request:

    https://github.com/apache/jena/pull/212#discussion_r99232613
  
    --- Diff: jena-core/src/main/java/org/apache/jena/graph/GraphUtil.java ---
    @@ -115,55 +117,44 @@ public static void add(Graph graph, Triple[] triples) 
{
         }
             
         public static void add(Graph graph, List<Triple> triples) {
    +        addIteratorWorkerDirect(graph, triples.iterator());
             if ( OldStyle && graph instanceof GraphWithPerform )
    -        {
    -            GraphWithPerform g = (GraphWithPerform)graph ;
    -            for (Triple t : triples)
    -                g.performAdd(t) ;
                 graph.getEventManager().notifyAddList(graph, triples) ;
    -        } else
    -        {
    -            for (Triple t : triples)
    -                graph.add(t) ;
    -        }
         }
             
         public static void add(Graph graph, Iterator<Triple> it) {
    -        // Materialize to avoid ConcurrentModificationException.
    -        List<Triple> s = IteratorCollection.iteratorToList(it) ;
    -        if ( OldStyle && graph instanceof GraphWithPerform )
    -        {
    -            GraphWithPerform g = (GraphWithPerform)graph ;
    -            for (Triple t : s)
    -                g.performAdd(t) ;
    +        if ( OldStyle && graph instanceof GraphWithPerform ) {
    +            // Materialize for the notify.
    +            List<Triple> s = IteratorCollection.iteratorToList(it) ;
    --- End diff --
    
    Note: there is no change in behaviour here - this change are only due to 
addIteratorWorkerDirect/addIteratorWorker.
    
    The notifcation requires a list so making that now the iterating on that is 
guaranteed CCME-free and so call `addIteratorWorkerDirect` with the necessary 
copy.
    
    This preserves event semantics, for better or worse.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to