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 e459ffc..a2c5cdd 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 @@ -110,6 +110,8 @@ public class ShutdownBootstrap extends AbstractBootstrap { shutdown(true); } + private static boolean x = true; + /** * Before Shutdown it execute the methods annotateds with @Shutdown considering the priority order; */ @@ -121,8 +123,12 @@ public class ShutdownBootstrap extends AbstractBootstrap { Collections.sort(processors); Throwable failure = null; - for (CustomContext tempContext : tempContexts) { - addContext(tempContext, abdEvent); + if (x) { + for (CustomContext tempContext : tempContexts) { + addContext(tempContext, abdEvent); + } + + x = false; } for (Iterator iter = processors.iterator(); iter.hasNext();) { 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 56cd2f5..b1f63a4 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 @@ -73,6 +73,8 @@ public class StartupBootstrap extends AbstractBootstrap { private static final List processors = Collections .synchronizedList(new ArrayList()); + private static AfterBeanDiscovery abdEvent; + /** * Observes all methods annotated with @Startup and create an instance of StartupAction for them * @@ -97,10 +99,7 @@ public class StartupBootstrap extends AbstractBootstrap { tempContexts.add(new ThreadLocalContext(SessionScoped.class)); tempContexts.add(new ThreadLocalContext(ConversationScoped.class)); tempContexts.add(new ThreadLocalContext(RequestScoped.class)); - - for (CustomContext tempContext : tempContexts) { - addContext(tempContext, event); - } + abdEvent = event; } /** @@ -110,6 +109,8 @@ public class StartupBootstrap extends AbstractBootstrap { startup(true); } + private static boolean x = true; + /** * After the deployment validation it execute the methods annotateds with @Startup considering the priority order; */ @@ -121,6 +122,14 @@ public class StartupBootstrap extends AbstractBootstrap { Collections.sort(processors); Throwable failure = null; + if (x) { + for (CustomContext tempContext : tempContexts) { + addContext(tempContext, abdEvent); + } + + x = false; + } + for (Iterator iter = processors.iterator(); iter.hasNext();) { StartupProcessor processor = iter.next(); -- libgit2 0.21.2