[ 
https://issues.apache.org/jira/browse/JENA-1237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15499060#comment-15499060
 ] 

Andy Seaborne commented on JENA-1237:
-------------------------------------

Possible cause:

{{PMapTupleTable.begin}} is a no-op method.  It does not touch the ThreadLocal 
"local" so that is not initialized and it is the ThreadLocal's withInitialthat 
sets the ThreadLocal.

If this is the cause, the fix is to initialize the thread local to null and set 
in {{begin}}.

{noformat}
    ThreadLocal<TupleMapType> local = withInitial(() -> null);
...
    public void begin(final ReadWrite rw) {
        local.set(master().get());
    }
{noformat}

> TIM not isolating transactions at the start
> -------------------------------------------
>
>                 Key: JENA-1237
>                 URL: https://issues.apache.org/jira/browse/JENA-1237
>             Project: Apache Jena
>          Issue Type: Bug
>    Affects Versions: Jena 3.1.0
>            Reporter: Andy Seaborne
>         Attachments: ReportTxn.java
>
>
> TIM is not creating the transaction isolation when {{begin(READ)}} is called 
> but on the first operation.
> The attached example has two other-thread actions that differ only in whether 
> the begin is followed by a dataset read action (thread 2) or not (thread 1).  
> This changes the output of otherwise identical actions.
> {{ThreadAction}} takes 3 parts - the first part executes before the 
> {{create}} returns, the second part when {{run}} is called and exceptions 
> captured, the 3rd part is clearup (called during {{run}}).
> Annotated output from the attached program:
> {noformat}
> DatasetGraphInMemory
> thread 1:1 : x=<no count>
> Main       : other1
> thread 2:1 : x=0
> Main       : other2
> Main 1     : x=0
> Main 2     : x=1
> thread 1:2 : x=1          ** Should be zero **
> thread 2:2 : x=0
> TDBDataset
> thread 1:1 : x=<no count>
> Main       : other1
> thread 2:1 : x=0
> Main       : other2
> Main 1     : x=0
> Main 2     : x=1
> thread 1:2 : x=0          ** Correctly zero **
> thread 2:2 : x=0
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to