[seam-commits] Seam SVN: r12603 - branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/init.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Fri Apr 23 07:02:36 EDT 2010


Author: manaRH
Date: 2010-04-23 07:02:35 -0400 (Fri, 23 Apr 2010)
New Revision: 12603

Modified:
   branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/init/Initialization.java
Log:
JBPAPP-4002 - removed useless lock in Initialization.redeploy()

Modified: branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/init/Initialization.java
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/init/Initialization.java	2010-04-23 10:36:35 UTC (rev 12602)
+++ branches/enterprise/JBPAPP_5_0/src/main/org/jboss/seam/init/Initialization.java	2010-04-23 11:02:35 UTC (rev 12603)
@@ -755,92 +755,84 @@
          return;
       }
       
-      ReentrantLock lock = new ReentrantLock();
-      if (lock.tryLock(500, TimeUnit.MILLISECONDS))
+      hotDeploymentStrategy = createHotDeployment(Thread.currentThread().getContextClassLoader(), isHotDeployEnabled(init));
+      
+      boolean changed = new TimestampCheckForwardingDeploymentStrategy()
       {
-         try
+         @Override
+         protected DeploymentStrategy delegate()
          {
-            hotDeploymentStrategy = createHotDeployment(Thread.currentThread().getContextClassLoader(), isHotDeployEnabled(init));
-            
-            boolean changed = new TimestampCheckForwardingDeploymentStrategy()
+            return hotDeploymentStrategy;
+         }
+         
+      }.changedSince(init.getTimestamp());
+      
+      if (hotDeploymentStrategy.available() && changed)
+      {
+         ServletLifecycle.beginReinitialization(request);
+         Contexts.getEventContext().set(HotDeploymentStrategy.NAME, hotDeploymentStrategy);
+         hotDeploymentStrategy.scan();
+         
+         if (hotDeploymentStrategy.getTimestamp() > init.getTimestamp())
+         {
+            log.debug("redeploying components");
+            Seam.clearComponentNameCache();
+            for (String name : init.getHotDeployableComponents())
             {
-               @Override
-               protected DeploymentStrategy delegate()
+               Component component = Component.forName(name);
+               if (component != null)
                {
-                  return hotDeploymentStrategy;
-               }
-               
-            }.changedSince(init.getTimestamp());
-            
-            if (hotDeploymentStrategy.available() && changed)
-            {
-               ServletLifecycle.beginReinitialization(request);
-               Contexts.getEventContext().set(HotDeploymentStrategy.NAME, hotDeploymentStrategy);
-               hotDeploymentStrategy.scan();
-               
-               if (hotDeploymentStrategy.getTimestamp() > init.getTimestamp())
-               {
-                  log.debug("redeploying components");
-                  Seam.clearComponentNameCache();
-                  for ( String name: init.getHotDeployableComponents() )
+                  ScopeType scope = component.getScope();
+                  if (scope != ScopeType.STATELESS && scope.isContextActive())
                   {
-                     Component component = Component.forName(name);
-                     if (component!=null)
-                     {
-                        ScopeType scope = component.getScope();
-                        if ( scope!=ScopeType.STATELESS && scope.isContextActive() )
-                        {
-                           scope.getContext().remove(name);
-                        }
-                        init.removeObserverMethods(component);
-                     }
-                     Contexts.getApplicationContext().remove(name + COMPONENT_SUFFIX);
+                     scope.getContext().remove(name);
                   }
-               
-                  init.getHotDeployableComponents().clear();
-                  installHotDeployableComponents();
-                  installComponents(init);
-                  log.debug("done redeploying components");
+                  init.removeObserverMethods(component);
                }
-               // update the timestamp outside of the second timestamp check to be sure we don't cause an unnecessary scan
-               // the second scan checks annotations (the slow part) which might happen to exclude the most recent file
-               init.setTimestamp(System.currentTimeMillis());
-               ServletLifecycle.endReinitialization();
+               Contexts.getApplicationContext().remove(name + COMPONENT_SUFFIX);
             }
-               
-            final WarRootDeploymentStrategy warRootDeploymentStrategy = new WarRootDeploymentStrategy(Thread.currentThread().getContextClassLoader(), warRoot, new File[] { warClassesDirectory, warLibDirectory, hotDeployDirectory });
-            changed = new TimestampCheckForwardingDeploymentStrategy()
-            {
-               @Override
-               protected DeploymentStrategy delegate()
-               {
-                  return warRootDeploymentStrategy;
-               }
-               
-            }.changedSince(init.getWarTimestamp());
-            if (changed)
-            {
-               warRootDeploymentStrategy.scan();
-               if (warRootDeploymentStrategy.getTimestamp() > init.getWarTimestamp())
-               {
-                  log.debug("redeploying page descriptors...");
-                  Pages pages = (Pages) ServletLifecycle.getServletContext().getAttribute(Seam.getComponentName(Pages.class));
-                  if (pages != null) {
-                     // application context is needed for creating expressions
-                     Lifecycle.setupApplication();
-                     pages.initialize(warRootDeploymentStrategy.getDotPageDotXmlFileNames());
-                     Lifecycle.cleanupApplication();
-                  }
-                  ServletLifecycle.getServletContext().removeAttribute(Seam.getComponentName(Exceptions.class));
-                  init.setWarTimestamp(warRootDeploymentStrategy.getTimestamp());
-                  log.debug ("done redeploying page descriptors");
-               }
-            }
+            
+            init.getHotDeployableComponents().clear();
+            installHotDeployableComponents();
+            installComponents(init);
+            log.debug("done redeploying components");
          }
-         finally
+         // update the timestamp outside of the second timestamp check to be
+         // sure we don't cause an unnecessary scan
+         // the second scan checks annotations (the slow part) which might
+         // happen to exclude the most recent file
+         init.setTimestamp(System.currentTimeMillis());
+         ServletLifecycle.endReinitialization();
+      }
+      
+      final WarRootDeploymentStrategy warRootDeploymentStrategy = new WarRootDeploymentStrategy(Thread.currentThread().getContextClassLoader(), warRoot, new File[] { warClassesDirectory, warLibDirectory, hotDeployDirectory });
+      changed = new TimestampCheckForwardingDeploymentStrategy()
+      {
+         @Override
+         protected DeploymentStrategy delegate()
          {
-            lock.unlock();
+            return warRootDeploymentStrategy;
          }
+         
+      }.changedSince(init.getWarTimestamp());
+      if (changed)
+      {
+         warRootDeploymentStrategy.scan();
+         if (warRootDeploymentStrategy.getTimestamp() > init.getWarTimestamp())
+         {
+            log.debug("redeploying page descriptors...");
+            Pages pages = (Pages) ServletLifecycle.getServletContext().getAttribute(Seam.getComponentName(Pages.class));
+            if (pages != null)
+            {
+               // application context is needed for creating expressions
+               Lifecycle.setupApplication();
+               pages.initialize(warRootDeploymentStrategy.getDotPageDotXmlFileNames());
+               Lifecycle.cleanupApplication();
+            }
+            ServletLifecycle.getServletContext().removeAttribute(Seam.getComponentName(Exceptions.class));
+            init.setWarTimestamp(warRootDeploymentStrategy.getTimestamp());
+            log.debug("done redeploying page descriptors");
+         }
       }
    }
 



More information about the seam-commits mailing list