Skip to content

Commit

Permalink
[WELD-891]; fix shutdown order, adjust AS7 boot.
Browse files Browse the repository at this point in the history
  • Loading branch information
alesj committed Oct 25, 2011
1 parent f2fab48 commit b68c8b1
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 4 deletions.
Expand Up @@ -116,6 +116,7 @@
* detects and register beans
*
* @author Pete Muir
* @author Ales Justin
*/
public class WeldBootstrap implements Bootstrap {

Expand Down Expand Up @@ -437,10 +438,9 @@ public void shutdown() {
try {
ApplicationContext applicationContext = deploymentManager.instance().select(ApplicationContext.class).get();
try {
applicationContext.invalidate();
BeforeShutdownImpl.fire(deploymentManager, beanDeployments);
} finally {

applicationContext.invalidate();
}
} finally {
Container.instance().setState(ContainerState.SHUTDOWN);
Expand Down
4 changes: 2 additions & 2 deletions jboss-tck-runner/pom.xml
Expand Up @@ -235,7 +235,7 @@
<suiteXmlFile>src/test/resources/tck-tests.xml</suiteXmlFile>
</suiteXmlFiles>
<systemPropertyVariables>
<jboss.server.config.file.name>standalone-preview.xml</jboss.server.config.file.name>
<jboss.server.config.file.name>standalone.xml</jboss.server.config.file.name>
</systemPropertyVariables>
<systemProperties>
<property>
Expand Down Expand Up @@ -301,7 +301,7 @@
<suiteXmlFile>src/test/resources/tck-tests.xml</suiteXmlFile>
</suiteXmlFiles>
<systemPropertyVariables>
<jboss.server.config.file.name>standalone-preview.xml</jboss.server.config.file.name>
<jboss.server.config.file.name>standalone.xml</jboss.server.config.file.name>
</systemPropertyVariables>
<systemProperties>
<property>
Expand Down
@@ -0,0 +1,38 @@
/*
* JBoss, Home of Professional Open Source.
* Copyright 2011, Red Hat, Inc., and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/

package org.jboss.weld.tests.extensions.lifecycle;

import javax.enterprise.event.Observes;
import javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.inject.spi.BeforeShutdown;
import javax.enterprise.inject.spi.Extension;

/**
* @author Aaron Anderson
* @author <a href="mailto:ales.justin@jboss.org">Ales Justin</a>
*/
public class BeforeShutdownExt implements Extension {
public void beforeShutdown(@Observes BeforeShutdown bfs, BeanManager bm) {
System.out.format("BeforeShutdown \n");
}
}
@@ -0,0 +1,57 @@
/*
* JBoss, Home of Professional Open Source.
* Copyright 2011, Red Hat, Inc., and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/

package org.jboss.weld.tests.extensions.lifecycle;

import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.BeanArchive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;

import javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.inject.spi.Extension;

/**
* @author Aaron Anderson
* @author <a href="mailto:ales.justin@jboss.org">Ales Justin</a>
*/
@RunWith(Arquillian.class)
public class BeforeShutdownExtTest {

@Deployment
public static Archive getDeployment() {
return ShrinkWrap.create(BeanArchive.class)
.addPackage(BeforeShutdownExt.class.getPackage())
.addAsServiceProvider(Extension.class, BeforeShutdownExt.class);
}

@Test
public void testExt(BeanManager bm) throws Exception {
System.err.println("----------- HERE -----------");
Assert.assertNotNull(bm);
}

}

0 comments on commit b68c8b1

Please sign in to comment.