refactor: extract @VaadinSessionScoped activation into managed bean#515
Conversation
|
Let's also follow the internal discussion in Slack. |
Move the activation predicate and storage-access logic out of `VaadinSessionScopedContext` into a nested `ContextualStorageManager` managed bean. The context becomes a thin delegator. As a side effect, applications may replace the bean via CDI `@Specializes` to adjust behavior — though the manager is intentionally undocumented and overriding it is at the integrator's own risk. Adds integration tests covering the strict default and the lenient `@Specializes` scenario from a background thread that does not hold the session lock. References #506
b55d903 to
f3b3b0f
Compare
`SessionContextSpecializesView` joined the spawned background thread with a 5 s timeout: in the lenient `@Specializes` deployment the thread waits in `VaadinSession#accessSynchronously` for the session lock held by the joining request thread, so an unbounded join would deadlock. Every click stalled the full 5 s and the assertions raced the still-running thread. The click listener now only starts the thread, removing the lock inversion entirely. The thread increments a completion counter in its `finally` block, and the tests synchronize on it via a new `waitForCount()` helper before asserting.
|
Hi @mcollovati and @mcollovati, when i performed cherry-pick to this commit to 15.2, i have encountered the following issue. Can you take a look and pick it manually? |
|
Is there a plan for when the new Vaadin CDI 16.x version will be released, and will it be included in that release, since only 15.2 is listed? |
…#515) (#516) Move the activation predicate and storage-access logic out of `VaadinSessionScopedContext` into a nested `ContextualStorageManager` managed bean. The context becomes a thin delegator. As a side effect, applications may replace the bean via CDI `@Specializes` to adjust behavior — though the manager is intentionally undocumented and overriding it is at the integrator's own risk. Adds integration tests covering the strict default and the lenient `@Specializes` scenario from a background thread that does not hold the session lock. References #506
|
Hi @nico-fri , Vaadin CDI 16.0.2 has been released with this fix, you can get it from maven central already. Vaadin Platform with the cooresponding CDI addon version will be released in the next weeks. 🙇 |
Move the activation predicate and storage-access logic out of
VaadinSessionScopedContextinto a nestedContextualStorageManagermanaged bean. The context becomes a thin delegator. As a side effect, applications may replace the bean via CDI@Specializesto adjust behavior — though the manager is intentionally undocumented and overriding it is at the integrator's own risk.Adds integration tests covering the strict default and the lenient
@Specializesscenario from a background thread that does not hold the session lock.References #506