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,7 +67,7 @@ public class ShutdownBootstrap extends AbstractBootstrap { | ||
| 67 | private static final Class<? extends Annotation> annotationClass = Shutdown.class; | 67 | private static final Class<? extends Annotation> annotationClass = Shutdown.class; |
| 68 | 68 | ||
| 69 | private static final List<CustomContext> tempContexts = new ArrayList<CustomContext>(); | 69 | private static final List<CustomContext> tempContexts = new ArrayList<CustomContext>(); |
| 70 | - | 70 | + |
| 71 | private static AfterBeanDiscovery abdEvent; | 71 | private static AfterBeanDiscovery abdEvent; |
| 72 | 72 | ||
| 73 | @SuppressWarnings("rawtypes") | 73 | @SuppressWarnings("rawtypes") |
| @@ -105,8 +105,15 @@ public class ShutdownBootstrap extends AbstractBootstrap { | @@ -105,8 +105,15 @@ public class ShutdownBootstrap extends AbstractBootstrap { | ||
| 105 | /** | 105 | /** |
| 106 | * Before Shutdown it execute the methods annotateds with @Shutdown considering the priority order; | 106 | * Before Shutdown it execute the methods annotateds with @Shutdown considering the priority order; |
| 107 | */ | 107 | */ |
| 108 | - @SuppressWarnings({ "unchecked", "rawtypes" }) | ||
| 109 | public synchronized static void shutdown() { | 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 | getLogger().debug( | 117 | getLogger().debug( |
| 111 | getBundle("demoiselle-core-bundle").getString("executing-all", annotationClass.getSimpleName())); | 118 | getBundle("demoiselle-core-bundle").getString("executing-all", annotationClass.getSimpleName())); |
| 112 | 119 | ||
| @@ -116,13 +123,16 @@ public class ShutdownBootstrap extends AbstractBootstrap { | @@ -116,13 +123,16 @@ public class ShutdownBootstrap extends AbstractBootstrap { | ||
| 116 | for (CustomContext tempContext : tempContexts) { | 123 | for (CustomContext tempContext : tempContexts) { |
| 117 | addContext(tempContext, abdEvent); | 124 | addContext(tempContext, abdEvent); |
| 118 | } | 125 | } |
| 119 | - | 126 | + |
| 120 | for (Iterator<ShutdownProcessor> iter = processors.iterator(); iter.hasNext();) { | 127 | for (Iterator<ShutdownProcessor> iter = processors.iterator(); iter.hasNext();) { |
| 121 | ShutdownProcessor processor = iter.next(); | 128 | ShutdownProcessor processor = iter.next(); |
| 122 | 129 | ||
| 123 | try { | 130 | try { |
| 124 | processor.process(); | 131 | processor.process(); |
| 125 | - iter.remove(); | 132 | + |
| 133 | + if (remove) { | ||
| 134 | + iter.remove(); | ||
| 135 | + } | ||
| 126 | 136 | ||
| 127 | } catch (Throwable cause) { | 137 | } catch (Throwable cause) { |
| 128 | failure = cause; | 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,8 +104,15 @@ public class StartupBootstrap extends AbstractBootstrap { | ||
| 104 | /** | 104 | /** |
| 105 | * After the deployment validation it execute the methods annotateds with @Startup considering the priority order; | 105 | * After the deployment validation it execute the methods annotateds with @Startup considering the priority order; |
| 106 | */ | 106 | */ |
| 107 | - @SuppressWarnings({ "unchecked", "rawtypes" }) | ||
| 108 | public synchronized static void startup() { | 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 | getLogger().debug( | 116 | getLogger().debug( |
| 110 | getBundle("demoiselle-core-bundle").getString("executing-all", annotationClass.getSimpleName())); | 117 | getBundle("demoiselle-core-bundle").getString("executing-all", annotationClass.getSimpleName())); |
| 111 | 118 | ||
| @@ -117,7 +124,10 @@ public class StartupBootstrap extends AbstractBootstrap { | @@ -117,7 +124,10 @@ public class StartupBootstrap extends AbstractBootstrap { | ||
| 117 | 124 | ||
| 118 | try { | 125 | try { |
| 119 | processor.process(); | 126 | processor.process(); |
| 120 | - iter.remove(); | 127 | + |
| 128 | + if (remove) { | ||
| 129 | + iter.remove(); | ||
| 130 | + } | ||
| 121 | 131 | ||
| 122 | } catch (Throwable cause) { | 132 | } catch (Throwable cause) { |
| 123 | failure = cause; | 133 | failure = cause; |