You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by ajs6f <gi...@git.apache.org> on 2015/12/13 15:27:57 UTC

[GitHub] jena pull request: JENA-1085: Common pattern for transaction lifec...

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

    https://github.com/apache/jena/pull/108#discussion_r47445013
  
    --- Diff: jena-arq/src/main/java/org/apache/jena/sparql/core/mem/DatasetGraphInMemory.java ---
    @@ -55,21 +51,15 @@
     
         private final DatasetPrefixStorage prefixes = new DatasetPrefixStorageInMemory();
     
    +    /** This lock imposes the multiple-reader and single-writer policy of transactions */
         private final Lock writeLock = new LockMRPlusSW();
     
    -    private Lock writeLock() {
    -        return writeLock;
    -    }
    -
    -    private final ReentrantReadWriteLock commitLock = new ReentrantReadWriteLock(true);
    -
         /**
    -     * Commits must be atomic, and because a thread that is committing alters the various indexes one after another, we
    -     * lock out {@link #begin(ReadWrite)} while {@link #commit()} is executing.
    +     * Transaction lifecycle operations must be atomi, especially begin and commit where
    --- End diff --
    
    This comment is a bit confusing. How about:
    ```
    We have a lock for committing because transaction lifecycle operations must be atomic, especially {@link Transactional#begin} and {@link Transactional#commit}, for which the global state of the (possibly multiple) indexes may be read or written one after another.
    ```


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---