Open vaadin-bot opened 11 years ago
Originally by @jdahlstrom
Would these be "lock-acquire listeners" or "access listeners"? These are logically distinct, as queued access invocations are run in the same critical section. If the former, would the listeners be run when reentrantly acquiring the lock, or only at the actual boundaries of the critical section?
Originally by @Legioth
At least the JPA would just get more complicated if events would be fired for reentrant access. I don't know any other use case that would benefit from doing so either.
Queued access invocations are contributing to the same response or push message, so it would probably make sense to just draw the boundary at the critical section, i.e. "lock-acquire listeners". For the naming I would still like to stay away from using the word "lock" because it makes this sound too complicated. My suggestions would be:
AccessListener
even though multiple accesses using the same critical section would be covered by only one set of events. The logic is basically that 1) now the contents of this session will be accessed and 2) now the access is completed and the session will not be used again until there's a new event.TransactionListener
even though the semantics are not the same as the similarly named listeners in Vaadin 6. One problematic detail with this name is that Vaadin does not in itself support transactions since there's no way of rolling back changes to the UI state.Hello there!
It looks like this issue hasn't progressed lately. There are so many issues that we just can't deal them all within a reasonable timeframe.
There are a couple of things you could help to get things rolling on this issue (this is an automated message, so expect that some of these are already in use):
Thanks again for your contributions! Even though we haven't been able to get this issue fixed, we hope you to report your findings and enhancement ideas in the future too!
Originally by @Legioth
Frameworks like JPA are often used with a transaction-per-request pattern where a new transaction is started at the beginning of every request and then committed or rolled back the request after the request has been handled.
In Vaadin 6, this was usually implemented using
TransactionListener
orHttpServletRequestListener
. Vaadin 7 removed support for those features and it was instead recommend to use a servlet filter (see e.g. #10983). The introduction of server push andUI.access(Runnable)
in Vaadin 7.1 furthermore means that the same HTTP request might (asynchronously) touch multiple sessions that should probably each have their own transaction. The push support also encourages patterns where a session is accessed outside the context of a HTTP request, e.g. from a custom worker thread.All in all, it seems that the concept of transaction-per-request can no longer work sensibly with Vaadin applications. Transactions should instead be bound to session access; starting a transaction when locking the UI and ending the transaction when unlocking.
To support this, events should be fired whenever VaadinSession is locked or unlocked. Some thoughts about the implementation:
access()
from an unrelated request or a custom thread.access()
for the same session during a lock event would queue theRunnable
to be run after all listeners have been notified.access()
for the same session during an unlock event would schedule a new access (firing new lock and unlock events) after all listeners have been notified. The lock is released between the two accesses to give other accessors a chance.Imported from https://dev.vaadin.com/ issue #12256