You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "tandraschko (via GitHub)" <gi...@apache.org> on 2024/04/21 11:41:51 UTC

Re: [PR] MYFACES-4660 4.1 view destroying fix + keeping track of user connection in multiple tabs [myfaces]

tandraschko commented on code in PR #705:
URL: https://github.com/apache/myfaces/pull/705#discussion_r1573723120


##########
impl/src/main/java/org/apache/myfaces/push/cdi/WebsocketScopeManager.java:
##########
@@ -161,26 +161,12 @@ public static class ViewScope extends AbstractUserScope implements Serializable
         @Inject private WebsocketScopeManager scopeManager;
         @Inject private WebsocketSessionManager sessionManager;
         
-        /*
-         * If the view is discarded, destroy the websocket sessions associated with the view because they are no
-         * longer valid
-         */
         @PreDestroy
         public void destroy()
         {
-            // destroy parent scope ("session")
-            SessionScope sessionScope = (SessionScope) scopeManager.getScope(SCOPE_SESSION, false);
-            if (sessionScope != null)
-            {
-                for (String token : tokens.keySet())
-                {
-                    sessionScope.destroyChannelToken(token);
-                }
-            }
-
             channelTokens.clear();
             tokens.clear();
-       }
+        }

Review Comment:
   i think we still need to talk about this because of this comment:
   
   > The reason to do this is the connections must follow the same rules the view has, so if a view is disposed, all related websocket sessions must be disposed too on the server, and in that way we can avoid memory leaks.
   
   i think we have to do some other mechanism here as basically its correct
   
   you said:
   
   > any channelToken from the parent sessionScope is destroyed, even if it is still in use
   
   shouldnt it only destroy it for the current view, which is now expired?
   
       
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@myfaces.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org