List of usage examples for com.vaadin.server VaadinSession accessSynchronously
public void accessSynchronously(Runnable runnable)
From source file:de.metas.ui.web.vaadin.session.UserSession.java
License:Open Source License
public static final UserSession getCurrent() { final VaadinSession vaadinSession = VaadinSession.getCurrent(); if (vaadinSession == null) { return null; }//from w ww . ja v a 2 s . c o m if (vaadinSession.hasLock()) { return getCurrent(vaadinSession); } else { final Mutable<UserSession> userSessionRef = new Mutable<UserSession>(); vaadinSession.accessSynchronously(new Runnable() { @Override public void run() { userSessionRef.setValue(getCurrent(vaadinSession)); } }); return userSessionRef.getValue(); } }