From 3ce5d9eaada2392d111b74d2427ff242ed61a348 Mon Sep 17 00:00:00 2001 From: Leif Åstrand Date: Fri, 12 Apr 2013 11:09:02 +0300 Subject: Make AtmosphereResource field transient (#11512) Also add assert to catch theoretical case when old push connection is still active even though session has been deserialized Change-Id: I5b11a4ef273e36e90d97bfa84bf7e90bc2395fd7 --- .../com/vaadin/server/communication/AtmospherePushConnection.java | 2 +- server/src/com/vaadin/server/communication/PushHandler.java | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/server/src/com/vaadin/server/communication/AtmospherePushConnection.java b/server/src/com/vaadin/server/communication/AtmospherePushConnection.java index 8b146e3d50..0bd3dc5a14 100644 --- a/server/src/com/vaadin/server/communication/AtmospherePushConnection.java +++ b/server/src/com/vaadin/server/communication/AtmospherePushConnection.java @@ -37,7 +37,7 @@ public class AtmospherePushConnection implements Serializable, PushConnection { private UI ui; private boolean pending = true; - private AtmosphereResource resource; + private transient AtmosphereResource resource; public AtmospherePushConnection(UI ui) { this.ui = ui; diff --git a/server/src/com/vaadin/server/communication/PushHandler.java b/server/src/com/vaadin/server/communication/PushHandler.java index 146671e3a6..b2994d547f 100644 --- a/server/src/com/vaadin/server/communication/PushHandler.java +++ b/server/src/com/vaadin/server/communication/PushHandler.java @@ -109,6 +109,12 @@ public class PushHandler implements AtmosphereHandler { connection.connect(resource); } else if (req.getMethod().equalsIgnoreCase("POST")) { + assert connection.isConnected() : "Got push from the client " + + "even though the connection does not seem to be " + + "open. This might happen if a HttpSession is " + + "serialized and deserialized while the push " + + "connection is kept open."; + /* * We received a UIDL request through Atmosphere. If the push * channel is bidirectional (websockets), the request was sent -- cgit v1.2.3