[seam-commits] Seam SVN: r9254 - in trunk/src: main/org/jboss/seam/init and 1 other directory.
seam-commits at lists.jboss.org
seam-commits at lists.jboss.org
Fri Oct 10 14:14:55 EDT 2008
Author: pete.muir at jboss.org
Date: 2008-10-10 14:14:55 -0400 (Fri, 10 Oct 2008)
New Revision: 9254
Modified:
trunk/src/debug/org/jboss/seam/debug/hot/HotDeployFilter.java
trunk/src/main/org/jboss/seam/init/Initialization.java
Log:
JBSEAM-3491
Modified: trunk/src/debug/org/jboss/seam/debug/hot/HotDeployFilter.java
===================================================================
--- trunk/src/debug/org/jboss/seam/debug/hot/HotDeployFilter.java 2008-10-10 10:26:39 UTC (rev 9253)
+++ trunk/src/debug/org/jboss/seam/debug/hot/HotDeployFilter.java 2008-10-10 18:14:55 UTC (rev 9254)
@@ -39,7 +39,14 @@
Init init = (Init) getServletContext().getAttribute( Seam.getComponentName(Init.class) );
if ( init!=null)
{
- new Initialization( getServletContext() ).redeploy( (HttpServletRequest) request );
+ try
+ {
+ new Initialization( getServletContext() ).redeploy( (HttpServletRequest) request );
+ }
+ catch (InterruptedException e)
+ {
+ log.warn("Unable to redeploy, please try again");
+ }
}
chain.doFilter(request, response);
}
Modified: trunk/src/main/org/jboss/seam/init/Initialization.java
===================================================================
--- trunk/src/main/org/jboss/seam/init/Initialization.java 2008-10-10 10:26:39 UTC (rev 9253)
+++ trunk/src/main/org/jboss/seam/init/Initialization.java 2008-10-10 18:14:55 UTC (rev 9254)
@@ -22,6 +22,8 @@
import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeSet;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.ReentrantLock;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -723,56 +725,66 @@
return this;
}
- public Initialization redeploy(HttpServletRequest request)
+ public void redeploy(HttpServletRequest request) throws InterruptedException
{
- ServletLifecycle.beginReinitialization(request);
- hotDeploymentStrategy = createHotDeployment(Thread.currentThread().getContextClassLoader());
- if (hotDeploymentStrategy.isEnabled())
+ ReentrantLock lock = new ReentrantLock();
+ if (lock.tryLock(500, TimeUnit.MILLISECONDS))
{
- hotDeploymentStrategy.scan();
- Init init = Init.instance();
-
- if (init.getTimestamp() < hotDeploymentStrategy.getTimestamp())
+ try
{
- log.info("redeploying");
- Seam.clearComponentNameCache();
- for ( String name: init.getHotDeployableComponents() )
+ ServletLifecycle.beginReinitialization(request);
+ hotDeploymentStrategy = createHotDeployment(Thread.currentThread().getContextClassLoader());
+ if (hotDeploymentStrategy.isEnabled())
{
- Component component = Component.forName(name);
- if (component!=null)
+ hotDeploymentStrategy.scan();
+ Init init = Init.instance();
+
+ if (init.getTimestamp() < hotDeploymentStrategy.getTimestamp())
{
- ScopeType scope = component.getScope();
- if ( scope!=ScopeType.STATELESS && scope.isContextActive() )
+ log.info("redeploying");
+ Seam.clearComponentNameCache();
+ for ( String name: init.getHotDeployableComponents() )
{
- scope.getContext().remove(name);
+ 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);
}
- init.removeObserverMethods(component);
+
+ if (hotDeploymentStrategy.isHotDeployClassLoaderEnabled())
+ {
+ installHotDeployableComponents();
+ }
+ Contexts.getEventContext().set(HotDeploymentStrategy.NAME, hotDeploymentStrategy);
+ init.setTimestamp( System.currentTimeMillis() );
+ installComponents(init);
+ log.info("done redeploying");
}
- Contexts.getApplicationContext().remove(name + COMPONENT_SUFFIX);
+
+ WarRootDeploymentStrategy warRootDeploymentStrategy = new WarRootDeploymentStrategy(Thread.currentThread().getContextClassLoader(), warRoot);
+ warRootDeploymentStrategy.scan();
+ Contexts.getEventContext().set(WarRootDeploymentStrategy.NAME, warRootDeploymentStrategy);
+ Pages pages = Pages.instance();
+ if (pages!= null) {
+ pages.initialize();
+ }
+
+ Contexts.getApplicationContext().remove(Seam.getComponentName(Exceptions.class));
}
-
- if (hotDeploymentStrategy.isHotDeployClassLoaderEnabled())
- {
- installHotDeployableComponents();
- }
- Contexts.getEventContext().set(HotDeploymentStrategy.NAME, hotDeploymentStrategy);
- init.setTimestamp( System.currentTimeMillis() );
- installComponents(init);
- log.info("done redeploying");
+ ServletLifecycle.endReinitialization();
}
-
- WarRootDeploymentStrategy warRootDeploymentStrategy = new WarRootDeploymentStrategy(Thread.currentThread().getContextClassLoader(), warRoot);
- warRootDeploymentStrategy.scan();
- Contexts.getEventContext().set(WarRootDeploymentStrategy.NAME, warRootDeploymentStrategy);
- Pages pages = Pages.instance();
- if (pages!= null) {
- pages.initialize();
+ finally
+ {
+ lock.unlock();
}
-
- Contexts.getApplicationContext().remove(Seam.getComponentName(Exceptions.class));
}
- ServletLifecycle.endReinitialization();
- return this;
}
private void installHotDeployableComponents()
More information about the seam-commits
mailing list