diff --git a/impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/ApplicationLifecycleEvent.java b/impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/ApplicationLifecycleEvent.java deleted file mode 100644 index 69ef2ec..0000000 --- a/impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/ApplicationLifecycleEvent.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Demoiselle Framework - * Copyright (C) 2010 SERPRO - * ---------------------------------------------------------------------------- - * This file is part of Demoiselle Framework. - * - * Demoiselle Framework is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public License version 3 - * as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License version 3 - * along with this program; if not, see - * or write to the Free Software Foundation, Inc., 51 Franklin Street, - * Fifth Floor, Boston, MA 02110-1301, USA. - * ---------------------------------------------------------------------------- - * Este arquivo é parte do Framework Demoiselle. - * - * O Framework Demoiselle é um software livre; você pode redistribuí-lo e/ou - * modificá-lo dentro dos termos da GNU LGPL versão 3 como publicada pela Fundação - * do Software Livre (FSF). - * - * Este programa é distribuído na esperança que possa ser útil, mas SEM NENHUMA - * GARANTIA; sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou - * APLICAÇÃO EM PARTICULAR. Veja a Licença Pública Geral GNU/LGPL em português - * para maiores detalhes. - * - * Você deve ter recebido uma cópia da GNU LGPL versão 3, sob o título - * "LICENCA.txt", junto com esse programa. Se não, acesse - * ou escreva para a Fundação do Software Livre (FSF) Inc., - * 51 Franklin St, Fifth Floor, Boston, MA 02111-1301, USA. - */ -package br.gov.frameworkdemoiselle.internal.bootstrap; - -interface ApplicationLifecycleEvent { - - boolean removeProcessors(); -} diff --git a/impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/AsbratctLifecycleBootstrap.java b/impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/AsbratctLifecycleBootstrap.java index 15d4474..3b07be2 100644 --- a/impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/AsbratctLifecycleBootstrap.java +++ b/impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/AsbratctLifecycleBootstrap.java @@ -72,6 +72,8 @@ public abstract class AsbratctLifecycleBootstrap extends A private AfterBeanDiscovery afterBeanDiscoveryEvent; + private boolean registered = false; + protected abstract AnnotatedMethodProcessor newProcessorInstance(AnnotatedMethod annotatedMethod, BeanManager beanManager); @@ -105,22 +107,20 @@ public abstract class AsbratctLifecycleBootstrap extends A afterBeanDiscoveryEvent = event; } - private boolean x = true; - @SuppressWarnings({ "unchecked", "rawtypes" }) - protected synchronized void proccessEvent(final ApplicationLifecycleEvent event) { + protected synchronized void proccessEvent() { getLogger().debug( getBundle("demoiselle-core-bundle").getString("executing-all", annotationClass.getSimpleName())); Collections.sort(processors); Throwable failure = null; - if (x) { + if (!registered) { for (CustomContext tempContext : tempContexts) { addContext(tempContext, afterBeanDiscoveryEvent); } - x = false; + registered = true; } for (Iterator iter = processors.iterator(); iter.hasNext();) { @@ -132,10 +132,7 @@ public abstract class AsbratctLifecycleBootstrap extends A if (Thread.currentThread().getContextClassLoader().equals(classLoader)) { processor.process(); - - if (event.removeProcessors()) { - iter.remove(); - } + iter.remove(); } } catch (Throwable cause) { diff --git a/impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/BeforeApplicationFinalization.java b/impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/BeforeApplicationFinalization.java index 796902b..c16d7be 100644 --- a/impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/BeforeApplicationFinalization.java +++ b/impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/BeforeApplicationFinalization.java @@ -36,6 +36,6 @@ */ package br.gov.frameworkdemoiselle.internal.bootstrap; -public interface BeforeApplicationFinalization extends ApplicationLifecycleEvent { +public interface BeforeApplicationFinalization { } diff --git a/impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/BeforeApplicationInitialization.java b/impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/BeforeApplicationInitialization.java index 040f9ea..3031ce5 100644 --- a/impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/BeforeApplicationInitialization.java +++ b/impl/core/src/main/java/br/gov/frameworkdemoiselle/internal/bootstrap/BeforeApplicationInitialization.java @@ -36,6 +36,6 @@ */ package br.gov.frameworkdemoiselle.internal.bootstrap; -public interface BeforeApplicationInitialization extends ApplicationLifecycleEvent { +public interface BeforeApplicationInitialization { } 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 de18562..92f23b5 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 @@ -56,6 +56,6 @@ public class ShutdownBootstrap extends AsbratctLifecycleBootstrap { } public void shutdown(@Observes BeforeApplicationFinalization event) { - proccessEvent(event); + proccessEvent(); } } 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 f09eb97..08af835 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 @@ -56,6 +56,6 @@ public class StartupBootstrap extends AsbratctLifecycleBootstrap { } public void startup(@Observes BeforeApplicationInitialization event) { - proccessEvent(event); + proccessEvent(); } } diff --git a/impl/extension/servlet/src/main/java/br/gov/frameworkdemoiselle/util/ServletListener.java b/impl/extension/servlet/src/main/java/br/gov/frameworkdemoiselle/util/ServletListener.java index 922fc53..1788e40 100644 --- a/impl/extension/servlet/src/main/java/br/gov/frameworkdemoiselle/util/ServletListener.java +++ b/impl/extension/servlet/src/main/java/br/gov/frameworkdemoiselle/util/ServletListener.java @@ -46,22 +46,12 @@ public class ServletListener implements javax.servlet.ServletContextListener { @Override public void contextInitialized(ServletContextEvent event) { Beans.getBeanManager().fireEvent(new BeforeApplicationInitialization() { - - @Override - public boolean removeProcessors() { - return true; - } }); } @Override public void contextDestroyed(ServletContextEvent event) { Beans.getBeanManager().fireEvent(new BeforeApplicationFinalization() { - - @Override - public boolean removeProcessors() { - return true; - } }); } } -- libgit2 0.21.2