[
https://issues.apache.org/jira/browse/IGNITE-5712?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16103294#comment-16103294
]
Nikolay Izhikov commented on IGNITE-5712:
-----------------------------------------
[~sboikov]
> error message is wrong in TxManager.resumeTx
My bad, will fix it.
> please explain why synchronized (this) is needed in
> GridNearTxLocal.suspend/resume
1. suspend:
right after `tx.state(SUSPENDED)`
internal TxManager maps has incostintent state.
Transaction already SUSPENDED and available for tx.resume execution but
`threadMap` and `transactionMap` not updated.
I try to prevent following situation:
{code:java}
//Thread 1
tx.suspend()
...
tx.state(SUSPENDED);
//Thread 1 paused
//Thread 2
tx.resume()
...
assert !threadMap.containsValue(tx); // this map not cleared yet by Thread1
if (transactionMap(tx).putIfAbsent(tx.xidVersion(), tx) != null) //this map
not cleared yet by Thread1
{code}
2 resume:
If several thread concurrently try to resume tx only one can succeed so we need
to synchronize.
> Context switching for optimistic transactions
> ---------------------------------------------
>
> Key: IGNITE-5712
> URL: https://issues.apache.org/jira/browse/IGNITE-5712
> Project: Ignite
> Issue Type: Sub-task
> Components: general
> Reporter: Alexey Kuznetsov
> Assignee: Nikolay Izhikov
>
> Implement context switching between threads for optimistic transactions
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)