| Summary: | Need pre / post hooks for Transaction execution | ||
|---|---|---|---|
| Product: | [Modeling] EMF Services | Reporter: | Steven R. Shaw <steveshaw> |
| Component: | Transaction | Assignee: | Christian Damus <give.a.damus> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P2 | CC: | schafe |
| Version: | unspecified | Keywords: | api, noteworthy, plan |
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | Client Control | ||
|
Description
Steven R. Shaw
Can you provide an indication of how feasible this is and/or what the api impact for clients would be? The post hook would be best after the postCommit call. So that the pre and post hooks wrap the entire execution of the transaction including the postCommit notifications. For GMF's case, this can be implemented internally by extending the InternalTransactionalEditingDomain methods activate(InternalTransaction) and deactivate(InternalTransaction) to implement the required hooks. However, GMF won't be the only client that can benefit from generic notifications of starting and closing of transactions. I imagine a new listener interface (TransactionalEditingDomainListener) for domain-level state changes, which would include: - transactionAboutToStart - transactionStarted - transactionAboutToClose - transactionClosed - editingDomainDisposed Note that, unlike in some other listener APIs, the "about to" events would not be vetoable. Also, any number of "transactionAboutToStart" events could occur on different threads (concurrently) before a "transactionStarted", because about-to-start will be fired before a thread tries to get the lock. The transactionClosed event would occur after the transaction closed, either by commit or by rollback, regardless of whether any ResourceSetChangedEvents were sent to ResourceSetListeners. There would be no impact to clients as this would be entirely new API, except perhaps for any clients that implement the TransactionalEditingDomain interface without extending TransactionalEditingDomainImpl (which they really should not do). For this reason, it may be necessary to define an extension interface for the add/remove listener methods. *** Bug 145880 has been marked as a duplicate of this bug. *** As this is a new API and no longer blocks bug 145880 (which was resolved by a more appropriate fix), this is deferred to the next release (2.0 or 1.1, whichever comes first). It is undoubtedly still a useful API. Est.: .5w Committers can't contain this enhancement in their schedule; looking for help. Postponing to the 1.2 release for consideration in the planning process. Added a new TransactionalEditingDomainListener interface with call-backs: - transactionStarting - transactionInterrupted - transactionStarted - transactionClosing - transactionClosed Implementations of this listener interface are added to and removed from an editing domain using a new TransactionalEditingDomain.Lifecycle interface, which is an "optional adapter" available via TransactionUtil.getAdapter(...). As with all adapter interfaces, the Lifecycle protocol is optional. JUnit tests included. Restore original target after milestones were deranged. |