Commit 6ab6848af214947a77539f91eacadf4d5a5fdd35
Exists in
master
Merge branch '2.3' of https://github.com/demoiselle/framework.git into 2.3
Showing
2 changed files
with
26 additions
and
6 deletions
Show diff stats
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/ShutdownBootstrap.java
... | ... | @@ -67,7 +67,7 @@ public class ShutdownBootstrap extends AbstractBootstrap { |
67 | 67 | private static final Class<? extends Annotation> annotationClass = Shutdown.class; |
68 | 68 | |
69 | 69 | private static final List<CustomContext> tempContexts = new ArrayList<CustomContext>(); |
70 | - | |
70 | + | |
71 | 71 | private static AfterBeanDiscovery abdEvent; |
72 | 72 | |
73 | 73 | @SuppressWarnings("rawtypes") |
... | ... | @@ -105,8 +105,15 @@ public class ShutdownBootstrap extends AbstractBootstrap { |
105 | 105 | /** |
106 | 106 | * Before Shutdown it execute the methods annotateds with @Shutdown considering the priority order; |
107 | 107 | */ |
108 | - @SuppressWarnings({ "unchecked", "rawtypes" }) | |
109 | 108 | public synchronized static void shutdown() { |
109 | + shutdown(true); | |
110 | + } | |
111 | + | |
112 | + /** | |
113 | + * Before Shutdown it execute the methods annotateds with @Shutdown considering the priority order; | |
114 | + */ | |
115 | + @SuppressWarnings({ "unchecked", "rawtypes" }) | |
116 | + public synchronized static void shutdown(boolean remove) { | |
110 | 117 | getLogger().debug( |
111 | 118 | getBundle("demoiselle-core-bundle").getString("executing-all", annotationClass.getSimpleName())); |
112 | 119 | |
... | ... | @@ -116,13 +123,16 @@ public class ShutdownBootstrap extends AbstractBootstrap { |
116 | 123 | for (CustomContext tempContext : tempContexts) { |
117 | 124 | addContext(tempContext, abdEvent); |
118 | 125 | } |
119 | - | |
126 | + | |
120 | 127 | for (Iterator<ShutdownProcessor> iter = processors.iterator(); iter.hasNext();) { |
121 | 128 | ShutdownProcessor processor = iter.next(); |
122 | 129 | |
123 | 130 | try { |
124 | 131 | processor.process(); |
125 | - iter.remove(); | |
132 | + | |
133 | + if (remove) { | |
134 | + iter.remove(); | |
135 | + } | |
126 | 136 | |
127 | 137 | } catch (Throwable cause) { |
128 | 138 | failure = cause; | ... | ... |
impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/StartupBootstrap.java
... | ... | @@ -104,8 +104,15 @@ public class StartupBootstrap extends AbstractBootstrap { |
104 | 104 | /** |
105 | 105 | * After the deployment validation it execute the methods annotateds with @Startup considering the priority order; |
106 | 106 | */ |
107 | - @SuppressWarnings({ "unchecked", "rawtypes" }) | |
108 | 107 | public synchronized static void startup() { |
108 | + startup(true); | |
109 | + } | |
110 | + | |
111 | + /** | |
112 | + * After the deployment validation it execute the methods annotateds with @Startup considering the priority order; | |
113 | + */ | |
114 | + @SuppressWarnings({ "unchecked", "rawtypes" }) | |
115 | + public synchronized static void startup(boolean remove) { | |
109 | 116 | getLogger().debug( |
110 | 117 | getBundle("demoiselle-core-bundle").getString("executing-all", annotationClass.getSimpleName())); |
111 | 118 | |
... | ... | @@ -117,7 +124,10 @@ public class StartupBootstrap extends AbstractBootstrap { |
117 | 124 | |
118 | 125 | try { |
119 | 126 | processor.process(); |
120 | - iter.remove(); | |
127 | + | |
128 | + if (remove) { | |
129 | + iter.remove(); | |
130 | + } | |
121 | 131 | |
122 | 132 | } catch (Throwable cause) { |
123 | 133 | failure = cause; | ... | ... |