diff --git a/impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/ShutdownBootstrap.java b/impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/ShutdownBootstrap.java index 5b97469..3635bf8 100644 --- a/impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/ShutdownBootstrap.java +++ b/impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/ShutdownBootstrap.java @@ -67,7 +67,7 @@ public class ShutdownBootstrap extends AbstractBootstrap { private static final Class annotationClass = Shutdown.class; private static final List tempContexts = new ArrayList(); - + private static AfterBeanDiscovery abdEvent; @SuppressWarnings("rawtypes") @@ -105,8 +105,15 @@ public class ShutdownBootstrap extends AbstractBootstrap { /** * Before Shutdown it execute the methods annotateds with @Shutdown considering the priority order; */ - @SuppressWarnings({ "unchecked", "rawtypes" }) public synchronized static void shutdown() { + shutdown(true); + } + + /** + * Before Shutdown it execute the methods annotateds with @Shutdown considering the priority order; + */ + @SuppressWarnings({ "unchecked", "rawtypes" }) + public synchronized static void shutdown(boolean remove) { getLogger().debug( getBundle("demoiselle-core-bundle").getString("executing-all", annotationClass.getSimpleName())); @@ -116,13 +123,16 @@ public class ShutdownBootstrap extends AbstractBootstrap { for (CustomContext tempContext : tempContexts) { addContext(tempContext, abdEvent); } - + for (Iterator iter = processors.iterator(); iter.hasNext();) { ShutdownProcessor processor = iter.next(); try { processor.process(); - iter.remove(); + + if (remove) { + iter.remove(); + } } catch (Throwable cause) { failure = cause; diff --git a/impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/StartupBootstrap.java b/impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/StartupBootstrap.java index 3f88cad..1ae54ee 100644 --- a/impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/StartupBootstrap.java +++ b/impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/StartupBootstrap.java @@ -104,8 +104,15 @@ public class StartupBootstrap extends AbstractBootstrap { /** * After the deployment validation it execute the methods annotateds with @Startup considering the priority order; */ - @SuppressWarnings({ "unchecked", "rawtypes" }) public synchronized static void startup() { + startup(true); + } + + /** + * After the deployment validation it execute the methods annotateds with @Startup considering the priority order; + */ + @SuppressWarnings({ "unchecked", "rawtypes" }) + public synchronized static void startup(boolean remove) { getLogger().debug( getBundle("demoiselle-core-bundle").getString("executing-all", annotationClass.getSimpleName())); @@ -117,7 +124,10 @@ public class StartupBootstrap extends AbstractBootstrap { try { processor.process(); - iter.remove(); + + if (remove) { + iter.remove(); + } } catch (Throwable cause) { failure = cause; -- libgit2 0.21.2