{
hotDeploymentStrategy = createHotDeployment(Thread.currentThread().getContextClassLoader());
if (hotDeploymentStrategy.isEnabled())
{
hotDeploymentStrategy.scan();
Init init = (Init) ServletLifecycle.getServletContext().getAttribute( Seam.getComponentName(Init.class) );
if (init.getTimestamp() < hotDeploymentStrategy.getTimestamp())
{
log.info("redeploying");
ServletLifecycle.beginReinitialization(request);
Seam.clearComponentNameCache();
for ( String name: init.getHotDeployableComponents() )
{
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);
}
if (hotDeploymentStrategy.isHotDeployClassLoaderEnabled())
{
installHotDeployableComponents();
}
Contexts.getEventContext().set(HotDeploymentStrategy.NAME, hotDeploymentStrategy);
init.setTimestamp( System.currentTimeMillis() );
installComponents(init);
ServletLifecycle.endReinitialization();
log.info("done redeploying");
}