You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by aj...@apache.org on 2020/03/12 17:13:08 UTC

[jena] branch UseAccessInstead created (now 25dc140)

This is an automated email from the ASF dual-hosted git repository.

ajs6f pushed a change to branch UseAccessInstead
in repository https://gitbox.apache.org/repos/asf/jena.git.


      at 25dc140  Use access() as per the rest of DatasetGraphInMemory

This branch includes the following new commits:

     new 25dc140  Use access() as per the rest of DatasetGraphInMemory

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[jena] 01/01: Use access() as per the rest of DatasetGraphInMemory

Posted by aj...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ajs6f pushed a commit to branch UseAccessInstead
in repository https://gitbox.apache.org/repos/asf/jena.git

commit 25dc140a1153aefef445458b627ddd30c647bc9d
Author: ajs6f <aj...@apache.org>
AuthorDate: Thu Mar 12 13:12:29 2020 -0400

    Use access() as per the rest of DatasetGraphInMemory
---
 .../java/org/apache/jena/sparql/core/mem/DatasetGraphInMemory.java  | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/DatasetGraphInMemory.java b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/DatasetGraphInMemory.java
index 9ad5e2b..85099f4 100644
--- a/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/DatasetGraphInMemory.java
+++ b/jena-arq/src/main/java/org/apache/jena/sparql/core/mem/DatasetGraphInMemory.java
@@ -299,7 +299,7 @@ public class DatasetGraphInMemory extends DatasetGraphTriplesQuads implements Tr
         }
     }
     
-    private <T> Iterator<T> access(final Supplier<Iterator<T>> source) {
+    private <T> T access(final Supplier<T> source) {
         return isInTransaction() ? source.get() : calculateRead(this, source::get);
     }
 
@@ -400,9 +400,7 @@ public class DatasetGraphInMemory extends DatasetGraphTriplesQuads implements Tr
 
     @Override
     public long size() {
-        return isInTransaction() 
-                ? quadsIndex().listGraphNodes().count()
-                : calculateRead(this, ()->quadsIndex().listGraphNodes().count());
+        return access(() -> quadsIndex().listGraphNodes().count());
     }
 
     @Override