[Transaction] Lifecycle events for nested transactions [message #1828193] |
Wed, 03 June 2020 10:42  |
Eclipse User |
|
|
|
Hi,
I am confused about this documentation vs behaviour discrepancy:
The doc for TransactionalEditingDomainListener.transactionStarted() states:
"Signals that a transaction has been activated. This event is not sent for nested transactions, nor for a transaction'sresumption from the yielded state. "
Now, if I run a write command which triggers a precommit command, the order of received events is:
Start Start Stop Stop. So, no matter how I try to think through, this looks like a bug, either in code or documentation:
A precommit transaction is either nested or not:
a) If a precommit transaction is a nested transaction, then there should only be one start/stop notification (or the documentation is wrong)
b) If a precommit transaction is not a nested transaction, then the order should be
start stop start stop
Am I missing something?
For my specific usecase, I only want to know if a transaction is active or not, so I can still do that by maintaining a stack, where start events push, and stop events pop, so no dealbreaker, but still it feels weird.
|
|
|
|
Re: [Transaction] Lifecycle events for nested transactions [message #1828218 is a reply to message #1828196] |
Thu, 04 June 2020 05:17   |
Eclipse User |
|
|
|
No, no special cases here, single simple test.
It really seems that the documentation does not apply to the precommit transactions. TransactionImpl.deactivate() sets activeTransaction to null, then processes precommits, and since active transaction is null, a new Transaction is started, triggering the second start notification. Only after that. Here's a stack that stops at the second received start event:
LifeCycleTests$2.transactionStarted(TransactionalEditingDomainEvent) line: 48
TransactionalEditingDomainImpl$LifecycleImpl.fireLifecycleEvent(int, Transaction) line: 1377
TransactionalEditingDomainImpl$LifecycleImpl.transactionStarted(InternalTransaction) line: 1418
TransactionImpl.start() line: 268
TransactionalEditingDomainImpl.startTransaction(boolean, Map<?,?>) line: 424
TransactionalEditingDomainImpl.runExclusive(Runnable) line: 321
TransactionalEditingDomainImpl.postcommit(InternalTransaction) line: 771
TransactionalEditingDomainImpl.deactivate(InternalTransaction) line: 543
EMFCommandTransaction(TransactionImpl).close() line: 712
EMFCommandTransaction(TransactionImpl).commit() line: 474
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05532 seconds