diff options
author | Leif Åstrand <leif@vaadin.com> | 2013-05-02 14:19:06 +0300 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2013-05-02 14:19:06 +0300 |
commit | 79e9ddc5247ae154d5f63ceeeb02afb293dbc91f (patch) | |
tree | 549b93d0ad704e43cc7b3521254dde7640e5450a /server/src/com/vaadin/ui/UI.java | |
parent | 80d96608dd9f2e0c067918065bfcdcfde0cb3414 (diff) | |
download | vaadin-framework-79e9ddc5247ae154d5f63ceeeb02afb293dbc91f.tar.gz vaadin-framework-79e9ddc5247ae154d5f63ceeeb02afb293dbc91f.zip |
Make access() throw if another session is already locked (#11757)
Change-Id: Ic8571b0d078c3ff64e8b9914e55c51766ae49024
Diffstat (limited to 'server/src/com/vaadin/ui/UI.java')
-rw-r--r-- | server/src/com/vaadin/ui/UI.java | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/server/src/com/vaadin/ui/UI.java b/server/src/com/vaadin/ui/UI.java index f260a6af79..6433bebbe4 100644 --- a/server/src/com/vaadin/ui/UI.java +++ b/server/src/com/vaadin/ui/UI.java @@ -1103,12 +1103,20 @@ public abstract class UI extends AbstractSingleComponentContainer implements * RPC handlers for components inside this UI do not need this method as the * session is automatically locked by the framework during request handling. * </p> + * <p> + * Note that calling this method while another session is locked by the + * current thread will cause an exception. This is to prevent deadlock + * situations when two threads have locked one session each and are both + * waiting for the lock for the other session. + * </p> * * @param runnable * the runnable which accesses the UI * @throws UIDetachedException * if the UI is not attached to a session (and locking can * therefore not be done) + * @throws IllegalStateException + * if the current thread holds the lock for another session * * @see #getCurrent() * @see VaadinSession#access(Runnable) @@ -1123,6 +1131,8 @@ public abstract class UI extends AbstractSingleComponentContainer implements throw new UIDetachedException(); } + VaadinService.verifyNoOtherSessionLocked(session); + session.lock(); try { if (getSession() == null) { |