List of usage examples for com.vaadin.util CurrentInstance setCurrent
public static Map<Class<?>, CurrentInstance> setCurrent(VaadinSession session)
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 w w . j a va 2s . c om // 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); } } }
From source file:org.eclipse.hawkbit.ui.DispatcherRunnable.java
License:Open Source License
@Override public void run() { CurrentInstance.setCurrent(session.getUIs().iterator().next()); CurrentInstance.setCurrent(session); SecurityContextHolder.setContext(userContext); eventBus.publish(this, event); }