List of usage examples for com.vaadin.util CurrentInstance restoreInstances
public static void restoreInstances(Map<Class<?>, CurrentInstance> old)
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(); }/* w ww .j a v a2s . 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); } } }