portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r548719 - in /portals/jetspeed-2/trunk: commons/src/java/org/apache/jetspeed/container/session/ components/portal/src/java/org/apache/jetspeed/container/session/
Date Tue, 19 Jun 2007 13:14:50 GMT
Author: ate
Date: Tue Jun 19 06:14:49 2007
New Revision: 548719

URL: http://svn.apache.org/viewvc?view=rev&rev=548719
Log:
Fix for JS2-735: Jetty-6 ConcurrentModificationException on logout
See: https://issues.apache.org/jira/browse/JS2-735#action_12506157

This change allows disabling forcing session invalidation from our own SessionsManager for
Jetty.
As Jetty on logout/invalidation of a session already invalidates *all* sessions, including
when redeploying a web application (sic), we don't need to enforce this ourselves then.

Modified:
    portals/jetspeed-2/trunk/commons/src/java/org/apache/jetspeed/container/session/PortletApplicationSessionMonitorImpl.java
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/session/PortalSessionMonitorImpl.java
    portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/session/PortalSessionsManagerImpl.java

Modified: portals/jetspeed-2/trunk/commons/src/java/org/apache/jetspeed/container/session/PortletApplicationSessionMonitorImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/commons/src/java/org/apache/jetspeed/container/session/PortletApplicationSessionMonitorImpl.java?view=diff&rev=548719&r1=548718&r2=548719
==============================================================================
--- portals/jetspeed-2/trunk/commons/src/java/org/apache/jetspeed/container/session/PortletApplicationSessionMonitorImpl.java
(original)
+++ portals/jetspeed-2/trunk/commons/src/java/org/apache/jetspeed/container/session/PortletApplicationSessionMonitorImpl.java
Tue Jun 19 06:14:49 2007
@@ -39,12 +39,19 @@
     private String portalSessionId;
     private long portalSessionKey;
     private transient HttpSession session;
+    private boolean forceInvalidate;
 
     public PortletApplicationSessionMonitorImpl(String contextPath, String portalSessionId,
long portalSessionKey)
     {
+        this(contextPath, portalSessionId, portalSessionKey, true);
+    }
+    
+    public PortletApplicationSessionMonitorImpl(String contextPath, String portalSessionId,
long portalSessionKey, boolean forceInvalidate)
+    {
         this.contextPath = contextPath;
         this.portalSessionId = portalSessionId;
         this.portalSessionKey = portalSessionKey;
+        this.forceInvalidate = forceInvalidate;
     }
     
     /* (non-Javadoc)
@@ -80,13 +87,16 @@
         {
             HttpSession thisSession = session;
             session = null;
-            try
-            {
-                thisSession.invalidate();
-            }
-            catch (Exception ise)
+            if (forceInvalidate)
             {
-                // ignore
+                try
+                {
+                    thisSession.invalidate();
+                }
+                catch (Exception ise)
+                {
+                    // ignore
+                }
             }
         }        
     }

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/session/PortalSessionMonitorImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/session/PortalSessionMonitorImpl.java?view=diff&rev=548719&r1=548718&r2=548719
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/session/PortalSessionMonitorImpl.java
(original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/session/PortalSessionMonitorImpl.java
Tue Jun 19 06:14:49 2007
@@ -36,10 +36,17 @@
     private long sessionKey;
     private transient String sessionId;
     private transient HttpSession session;
+    private boolean forceInvalidate;
     
     public PortalSessionMonitorImpl(long sessionKey)
     {
+        this(sessionKey,true);
+    }
+    
+    public PortalSessionMonitorImpl(long sessionKey, boolean forceInvalidate)
+    {
         this.sessionKey = sessionKey;
+        this.forceInvalidate = forceInvalidate;
     }
     
     /* (non-Javadoc)
@@ -68,13 +75,16 @@
         if ( thisSession != null )
         {
             session = null;
-            try
-            {
-                thisSession.invalidate();
-            }
-            catch (Exception ise)
+            if (forceInvalidate)
             {
-                // ignore
+                try
+                {
+                    thisSession.invalidate();
+                }
+                catch (Exception ise)
+                {
+                    // ignore
+                }
             }
         }
     }

Modified: portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/session/PortalSessionsManagerImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/session/PortalSessionsManagerImpl.java?view=diff&rev=548719&r1=548718&r2=548719
==============================================================================
--- portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/session/PortalSessionsManagerImpl.java
(original)
+++ portals/jetspeed-2/trunk/components/portal/src/java/org/apache/jetspeed/container/session/PortalSessionsManagerImpl.java
Tue Jun 19 06:14:49 2007
@@ -45,11 +45,18 @@
     
     private long portalSessionKeySequence;
     private Map portalSessionsRegistry;
+    private boolean forceInvalidate;
     
     public PortalSessionsManagerImpl()
     {
+        this(true);        
+    }
+    
+    public PortalSessionsManagerImpl(boolean forceInvalidate)
+    {
         portalSessionKeySequence = System.currentTimeMillis();
         portalSessionsRegistry = Collections.synchronizedMap(new HashMap());
+        this.forceInvalidate = forceInvalidate;
     }
     
     /* (non-Javadoc)
@@ -57,7 +64,7 @@
      */
     public synchronized void portalSessionCreated(HttpSession portalSession)
     {
-        PortalSessionMonitor psm = new PortalSessionMonitorImpl(++portalSessionKeySequence);
+        PortalSessionMonitor psm = new PortalSessionMonitorImpl(++portalSessionKeySequence,
forceInvalidate);
         portalSession.setAttribute(PortalSessionMonitor.SESSION_KEY, psm);
         // register it as if activated
         portalSessionDidActivate(psm);
@@ -119,6 +126,9 @@
             {
                 ((PortletApplicationSessionMonitor)iter.next()).invalidateSession();
             }
+            // To make sure its gone.
+            // You better not remove the psm from the portal session yourself ;)
+            psm.invalidateSession();
         }
     }
 
@@ -173,7 +183,7 @@
             }
             if ( pasm == null )
             {
-                pasm = new PortletApplicationSessionMonitorImpl(contextPath,portalSession.getId(),psr.portalSessionKey);
+                pasm = new PortletApplicationSessionMonitorImpl(contextPath,portalSession.getId(),psr.portalSessionKey,
forceInvalidate);
                 try
                 {
                     paSession.setAttribute(PortletApplicationSessionMonitor.SESSION_KEY,
pasm);
@@ -228,6 +238,9 @@
         if ( psr != null )
         {
             psr.sessionMonitors.remove(pasm.getContextPath());
+            // To make sure its gone.
+            // You better not remove the pasm from the session yourself ;)
+            pasm.invalidateSession();
         }
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message