List of usage examples for com.vaadin.ui UIDetachedException UIDetachedException
public UIDetachedException()
From source file:com.peergreen.webconsole.core.vaadin7.BaseUI.java
License:Open Source License
@Override public void accessSynchronously(Runnable runnable) { Map<Class<?>, CurrentInstance> old = null; VaadinSession session = getSession(); if (session == null) { throw new UIDetachedException(); }//from w w w . ja va 2 s . c o m // TODO PGWK-7 - hack to avoid exception when another session had lock //VaadinService.verifyNoOtherSessionLocked(session); session.lock(); try { if (getSession() == null) { // UI was detached after fetching the session but before we // acquired the lock. throw new UIDetachedException(); } old = CurrentInstance.setCurrent(this); runnable.run(); } finally { session.unlock(); if (old != null) { CurrentInstance.restoreInstances(old); } } }