Commit 94f5b7411ea176a63bc9be7ab26505409573e5df
1 parent
1c9a46eb
Exists in
master
Implementação experimental para funcionamento do bootstrap em EAR
Showing
2 changed files
with
21 additions
and
6 deletions
Show diff stats
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/ShutdownBootstrap.java
@@ -110,6 +110,8 @@ public class ShutdownBootstrap extends AbstractBootstrap { | @@ -110,6 +110,8 @@ public class ShutdownBootstrap extends AbstractBootstrap { | ||
110 | shutdown(true); | 110 | shutdown(true); |
111 | } | 111 | } |
112 | 112 | ||
113 | + private static boolean x = true; | ||
114 | + | ||
113 | /** | 115 | /** |
114 | * Before Shutdown it execute the methods annotateds with @Shutdown considering the priority order; | 116 | * Before Shutdown it execute the methods annotateds with @Shutdown considering the priority order; |
115 | */ | 117 | */ |
@@ -121,8 +123,12 @@ public class ShutdownBootstrap extends AbstractBootstrap { | @@ -121,8 +123,12 @@ public class ShutdownBootstrap extends AbstractBootstrap { | ||
121 | Collections.sort(processors); | 123 | Collections.sort(processors); |
122 | Throwable failure = null; | 124 | Throwable failure = null; |
123 | 125 | ||
124 | - for (CustomContext tempContext : tempContexts) { | ||
125 | - addContext(tempContext, abdEvent); | 126 | + if (x) { |
127 | + for (CustomContext tempContext : tempContexts) { | ||
128 | + addContext(tempContext, abdEvent); | ||
129 | + } | ||
130 | + | ||
131 | + x = false; | ||
126 | } | 132 | } |
127 | 133 | ||
128 | for (Iterator<ShutdownProcessor> iter = processors.iterator(); iter.hasNext();) { | 134 | for (Iterator<ShutdownProcessor> iter = processors.iterator(); iter.hasNext();) { |
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/StartupBootstrap.java
@@ -73,6 +73,8 @@ public class StartupBootstrap extends AbstractBootstrap { | @@ -73,6 +73,8 @@ public class StartupBootstrap extends AbstractBootstrap { | ||
73 | private static final List<StartupProcessor> processors = Collections | 73 | private static final List<StartupProcessor> processors = Collections |
74 | .synchronizedList(new ArrayList<StartupProcessor>()); | 74 | .synchronizedList(new ArrayList<StartupProcessor>()); |
75 | 75 | ||
76 | + private static AfterBeanDiscovery abdEvent; | ||
77 | + | ||
76 | /** | 78 | /** |
77 | * Observes all methods annotated with @Startup and create an instance of StartupAction for them | 79 | * Observes all methods annotated with @Startup and create an instance of StartupAction for them |
78 | * | 80 | * |
@@ -97,10 +99,7 @@ public class StartupBootstrap extends AbstractBootstrap { | @@ -97,10 +99,7 @@ public class StartupBootstrap extends AbstractBootstrap { | ||
97 | tempContexts.add(new ThreadLocalContext(SessionScoped.class)); | 99 | tempContexts.add(new ThreadLocalContext(SessionScoped.class)); |
98 | tempContexts.add(new ThreadLocalContext(ConversationScoped.class)); | 100 | tempContexts.add(new ThreadLocalContext(ConversationScoped.class)); |
99 | tempContexts.add(new ThreadLocalContext(RequestScoped.class)); | 101 | tempContexts.add(new ThreadLocalContext(RequestScoped.class)); |
100 | - | ||
101 | - for (CustomContext tempContext : tempContexts) { | ||
102 | - addContext(tempContext, event); | ||
103 | - } | 102 | + abdEvent = event; |
104 | } | 103 | } |
105 | 104 | ||
106 | /** | 105 | /** |
@@ -110,6 +109,8 @@ public class StartupBootstrap extends AbstractBootstrap { | @@ -110,6 +109,8 @@ public class StartupBootstrap extends AbstractBootstrap { | ||
110 | startup(true); | 109 | startup(true); |
111 | } | 110 | } |
112 | 111 | ||
112 | + private static boolean x = true; | ||
113 | + | ||
113 | /** | 114 | /** |
114 | * After the deployment validation it execute the methods annotateds with @Startup considering the priority order; | 115 | * After the deployment validation it execute the methods annotateds with @Startup considering the priority order; |
115 | */ | 116 | */ |
@@ -121,6 +122,14 @@ public class StartupBootstrap extends AbstractBootstrap { | @@ -121,6 +122,14 @@ public class StartupBootstrap extends AbstractBootstrap { | ||
121 | Collections.sort(processors); | 122 | Collections.sort(processors); |
122 | Throwable failure = null; | 123 | Throwable failure = null; |
123 | 124 | ||
125 | + if (x) { | ||
126 | + for (CustomContext tempContext : tempContexts) { | ||
127 | + addContext(tempContext, abdEvent); | ||
128 | + } | ||
129 | + | ||
130 | + x = false; | ||
131 | + } | ||
132 | + | ||
124 | for (Iterator<StartupProcessor> iter = processors.iterator(); iter.hasNext();) { | 133 | for (Iterator<StartupProcessor> iter = processors.iterator(); iter.hasNext();) { |
125 | StartupProcessor processor = iter.next(); | 134 | StartupProcessor processor = iter.next(); |
126 | 135 |