You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2013/02/06 21:03:14 UTC

svn commit: r1443175 - /jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateEngineNonStreaming.java

Author: andy
Date: Wed Feb  6 20:03:14 2013
New Revision: 1443175

URL: http://svn.apache.org/viewvc?rev=1443175&view=rev
Log:
Create the UpdateSink once, return the same object on each getUpdateSink call.

Modified:
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateEngineNonStreaming.java

Modified: jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateEngineNonStreaming.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateEngineNonStreaming.java?rev=1443175&r1=1443174&r2=1443175&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateEngineNonStreaming.java (original)
+++ jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateEngineNonStreaming.java Wed Feb  6 20:03:14 2013
@@ -33,7 +33,8 @@ public class UpdateEngineNonStreaming ex
     // This is the internal accumulator of update operations.
     // It is used to accumulate Updates so as not to alter
     // the UpdateRequest at the application level.
-    protected final UpdateRequest accRequests;
+    protected final UpdateRequest accRequests ;
+    protected final UpdateSink    updateSink ;
     
     /**
      * Creates a new Update Engine
@@ -44,6 +45,16 @@ public class UpdateEngineNonStreaming ex
     {
         super(graphStore, context) ;
         accRequests = new UpdateRequest();
+        updateSink = new UpdateRequestSink(accRequests)
+        {
+            @Override
+            public void close()
+            {
+                // Override the close() method to call execute() when we're done accepting update operations
+                super.close();
+                execute();
+            }
+        } ;
     }
 
     @Override
@@ -59,23 +70,11 @@ public class UpdateEngineNonStreaming ex
     }
     
     /**
-     * Creates an {@link UpdateSink} that adds all update operations into an internal {@code UpdateRequest} object.
+     * Returns an {@link UpdateSink} that adds all update operations into an internal {@link UpdateRequest} object.
      * After the last update operation has been added, the {@link #execute()} method is called.
      */
     @Override
-    public UpdateSink getUpdateSink()
-    {
-        // Override the close() method to call execute() when we're done accepting update operations
-        return new UpdateRequestSink(accRequests)
-        {
-            @Override
-            public void close()
-            {
-                super.close();
-                execute();
-            }
-        };
-    }
+    public UpdateSink getUpdateSink() { return updateSink ; }
     
     /**
      * Called after all of the update operations have been added to {@link #accRequests}.