diff options
author | Johannes Dahlström <johannesd@vaadin.com> | 2014-05-02 18:29:42 +0300 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2014-05-08 17:36:22 +0000 |
commit | f21c10882e74ec58260cae289c4180c19ff8a816 (patch) | |
tree | efd2f091b72a04bc17cdf308539e1d2767f1a3a4 /server | |
parent | 3184af5ac142b81ee656f0d5ea84272ac7e0ded8 (diff) | |
download | vaadin-framework-f21c10882e74ec58260cae289c4180c19ff8a816.tar.gz vaadin-framework-f21c10882e74ec58260cae289c4180c19ff8a816.zip |
Fix improper merge of 3d0ff32b from 7.1 to master (#13620)
Correctly call PushConnection.disconnect instead of setting to null.
Also remove the obsolete PushHandler.disconnectCallback.
Change-Id: Ied055d489a269b016318947cd89cf0b46003c596
Diffstat (limited to 'server')
-rw-r--r-- | server/src/com/vaadin/server/communication/PushHandler.java | 47 |
1 files changed, 6 insertions, 41 deletions
diff --git a/server/src/com/vaadin/server/communication/PushHandler.java b/server/src/com/vaadin/server/communication/PushHandler.java index c6126f9d21..983ada3279 100644 --- a/server/src/com/vaadin/server/communication/PushHandler.java +++ b/server/src/com/vaadin/server/communication/PushHandler.java @@ -186,46 +186,6 @@ public class PushHandler extends AtmosphereResourceEventListenerAdapter { } }; - /** - * Callback used when a connection is closed, either deliberately or because - * an error occurred. - */ - private final PushEventCallback disconnectCallback = new PushEventCallback() { - @Override - public void run(AtmosphereResource resource, UI ui) throws IOException { - PushMode pushMode = ui.getPushConfiguration().getPushMode(); - AtmospherePushConnection connection = getConnectionForUI(ui); - - String id = resource.uuid(); - - if (connection == null) { - getLogger() - .log(Level.WARNING, - "Could not find push connection to close: {0} with transport {1}", - new Object[] { id, resource.transport() }); - } else { - if (!pushMode.isEnabled()) { - /* - * The client is expected to close the connection after push - * mode has been set to disabled. - */ - getLogger().log(Level.FINER, - "Connection closed for resource {0}", id); - } else { - /* - * Unexpected cancel, e.g. if the user closes the browser - * tab. - */ - getLogger() - .log(Level.FINER, - "Connection unexpectedly closed for resource {0} with transport {1}", - new Object[] { id, resource.transport() }); - } - connection.disconnect(); - } - } - }; - private VaadinServletService service; public PushHandler(VaadinServletService service) { @@ -428,7 +388,12 @@ public class PushHandler extends AtmosphereResourceEventListenerAdapter { "Connection unexpectedly closed for resource {0} with transport {1}", new Object[] { id, resource.transport() }); } - ui.setPushConnection(null); + if (pushConnection.isConnected()) { + // disconnect() assumes the push connection is connected but + // this method can currently be called more than once during + // disconnect, depending on the situation + pushConnection.disconnect(); + } } } catch (final Exception e) { |