summaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin/Application.java
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2012-09-04 14:08:41 +0300
committerLeif Åstrand <leif@vaadin.com>2012-09-05 11:39:33 +0300
commitb3525638865cdea297c7f2e32c96221132af949f (patch)
tree32cf8874cfd0de5e5f1dcc05596cbeeaf87512b5 /server/src/com/vaadin/Application.java
parenta8f65623b64e64fbf4ccd885f1dfccf500e3dbf3 (diff)
downloadvaadin-framework-b3525638865cdea297c7f2e32c96221132af949f.tar.gz
vaadin-framework-b3525638865cdea297c7f2e32c96221132af949f.zip
Unify ThreadLocal handling (#9469)
Diffstat (limited to 'server/src/com/vaadin/Application.java')
-rw-r--r--server/src/com/vaadin/Application.java12
1 files changed, 3 insertions, 9 deletions
diff --git a/server/src/com/vaadin/Application.java b/server/src/com/vaadin/Application.java
index d2313c0566..088934c5f9 100644
--- a/server/src/com/vaadin/Application.java
+++ b/server/src/com/vaadin/Application.java
@@ -70,6 +70,7 @@ import com.vaadin.ui.AbstractField;
import com.vaadin.ui.Table;
import com.vaadin.ui.UI;
import com.vaadin.ui.Window;
+import com.vaadin.util.CurrentInstance;
import com.vaadin.util.ReflectTools;
/**
@@ -1799,13 +1800,6 @@ public class Application implements Terminal.ErrorListener, Serializable {
}
/**
- * Thread local for keeping track of currently used application instance
- *
- * @since 7.0
- */
- private static final ThreadLocal<Application> currentApplication = new ThreadLocal<Application>();
-
- /**
* Gets the currently used application. The current application is
* automatically defined when processing requests to the server. In other
* cases, (e.g. from background threads), the current application is not
@@ -1819,7 +1813,7 @@ public class Application implements Terminal.ErrorListener, Serializable {
* @since 7.0
*/
public static Application getCurrent() {
- return currentApplication.get();
+ return CurrentInstance.get(Application.class);
}
/**
@@ -1840,7 +1834,7 @@ public class Application implements Terminal.ErrorListener, Serializable {
* @since 7.0
*/
public static void setCurrent(Application application) {
- currentApplication.set(application);
+ CurrentInstance.setInheritable(Application.class, application);
}
/**