portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rwat...@apache.org
Subject svn commit: r828168 - /portals/jetspeed-2/portal/branches/JETSPEED-2.1.4/components/portal-site/src/java/org/apache/jetspeed/portalsite/impl/PortalSiteSessionContextImpl.java
Date Wed, 21 Oct 2009 20:02:33 GMT
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


Mime
View raw message