aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorLeif Åstrand <leif@vaadin.com>2012-11-26 15:01:02 +0200
committerLeif Åstrand <leif@vaadin.com>2012-11-26 15:01:02 +0200
commit4457324ff11dcaf848dd7364b74f8b0b47783e59 (patch)
tree9582c3064bda9e2e845c4473ce154bdfdeba4a2e /server
parentb010b21a15dfd47790255e36122d3b30682d4990 (diff)
downloadvaadin-framework-4457324ff11dcaf848dd7364b74f8b0b47783e59.tar.gz
vaadin-framework-4457324ff11dcaf848dd7364b74f8b0b47783e59.zip
Don't make VaadinSession serialize VaadinService (#10088)
* Refactor ApplicationRunnerServlet UIProvider to avoid indirect reference through anonymous inner class Change-Id: Ie4148e633192b1940ba82edbd26fbbc0cc2c4da3
Diffstat (limited to 'server')
-rw-r--r--server/src/com/vaadin/server/VaadinSession.java18
1 files changed, 16 insertions, 2 deletions
diff --git a/server/src/com/vaadin/server/VaadinSession.java b/server/src/com/vaadin/server/VaadinSession.java
index 5deb54f57c..205e4dc6cf 100644
--- a/server/src/com/vaadin/server/VaadinSession.java
+++ b/server/src/com/vaadin/server/VaadinSession.java
@@ -27,6 +27,7 @@ import java.util.Locale;
import java.util.Map;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
+import java.util.logging.Logger;
import javax.portlet.PortletSession;
import javax.servlet.http.HttpSession;
@@ -125,7 +126,7 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable {
private LinkedList<UIProvider> uiProviders = new LinkedList<UIProvider>();
- private VaadinService service;
+ private transient VaadinService service;
/**
* Create a new service session tied to a Vaadin service
@@ -153,7 +154,15 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable {
// If we are going to be unbound from the session, the session must be
// closing
// Notify the service
- service.fireSessionDestroy(this);
+ if (service == null) {
+ getLogger()
+ .warning(
+ "A VaadinSession instance not associated to any service is getting unbound. "
+ + "Session destroy events will not be fired and UIs in the session will not get detached. "
+ + "This might happen if a session is deserialized but never used before it expires.");
+ } else {
+ service.fireSessionDestroy(this);
+ }
session = null;
}
@@ -257,6 +266,7 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable {
if (attribute instanceof VaadinSession) {
VaadinSession vaadinSession = (VaadinSession) attribute;
vaadinSession.session = underlyingSession;
+ vaadinSession.service = service;
return vaadinSession;
}
@@ -896,4 +906,8 @@ public class VaadinSession implements HttpSessionBindingListener, Serializable {
public boolean isClosing() {
return closing;
}
+
+ private static final Logger getLogger() {
+ return Logger.getLogger(VaadinSession.class.getName());
+ }
}