You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by rw...@apache.org on 2009/10/21 22:02:33 UTC

svn commit: r828168 - /portals/jetspeed-2/portal/branches/JETSPEED-2.1.4/components/portal-site/src/java/org/apache/jetspeed/portalsite/impl/PortalSiteSessionContextImpl.java

Author: rwatler
Date: Wed Oct 21 20:02:33 2009
New Revision: 828168

URL: http://svn.apache.org/viewvc?rev=828168&view=rev
Log:
concurrent site view access and update deadlock patch

Modified:
    portals/jetspeed-2/portal/branches/JETSPEED-2.1.4/components/portal-site/src/java/org/apache/jetspeed/portalsite/impl/PortalSiteSessionContextImpl.java

Modified: portals/jetspeed-2/portal/branches/JETSPEED-2.1.4/components/portal-site/src/java/org/apache/jetspeed/portalsite/impl/PortalSiteSessionContextImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JETSPEED-2.1.4/components/portal-site/src/java/org/apache/jetspeed/portalsite/impl/PortalSiteSessionContextImpl.java?rev=828168&r1=828167&r2=828168&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JETSPEED-2.1.4/components/portal-site/src/java/org/apache/jetspeed/portalsite/impl/PortalSiteSessionContextImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JETSPEED-2.1.4/components/portal-site/src/java/org/apache/jetspeed/portalsite/impl/PortalSiteSessionContextImpl.java Wed Oct 21 20:02:33 2009
@@ -842,23 +842,47 @@
     public SiteView getSiteView()
     {
         // get or create site view
-        SiteView view = null;
-        boolean viewCreated = false;
-        synchronized (this)
+        SiteView view = siteView;
+        if (view == null)
         {
-            if ((siteView == null) && (pageManager != null) && (profileLocators != null))
+            // access site view and test for creation
+            boolean createView = false;
+            synchronized (this)
             {
-                // create new site view
-                siteView = new SiteView(pageManager, profileLocators);
-                viewCreated = true;
+                view = siteView;
+                createView = ((view == null) && (pageManager != null) && (profileLocators != null));
+            }
+
+            // create new site view if necessary
+            boolean viewCreated = false;
+            if (createView)
+            {
+                // create site view outside of synchronized state; this is
+                // required since construction of site view requires access
+                // to the page manager and page manager event notifications
+                // may arrive during construction of the site view which
+                // might then result in synchronized deadlock with page
+                // manager or page manager cache internals
+                view = new SiteView(pageManager, profileLocators);
+
+                // update site view if not already made available by another
+                // request thread
+                synchronized (this)
+                {
+                    if ((siteView == null) && (pageManager != null) && (profileLocators != null))
+                    {
+                        siteView = view;
+                        viewCreated = true;
+                    }
+                    view = siteView;
+                }
             }
-            view = siteView;
-        }
         
-        // log site view creation
-        if (viewCreated && log.isDebugEnabled())
-        {
-            log.debug("Created site view: search paths=" + view.getSearchPathsString());
+            // log site view creation
+            if (viewCreated && log.isDebugEnabled())
+            {
+                log.debug("Created site view: search paths=" + view.getSearchPathsString());
+            }
         }
         
         return view;



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