[jboss-cvs] JBossAS SVN: r106402 - in trunk: testsuite/imports and 12 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Jul 2 12:11:25 EDT 2010
Author: alex.loubyansky at jboss.com
Date: 2010-07-02 12:11:24 -0400 (Fri, 02 Jul 2010)
New Revision: 106402
Added:
trunk/testsuite/src/main/org/jboss/test/ejb/passivationcl/
trunk/testsuite/src/main/org/jboss/test/ejb/passivationcl/entity/
trunk/testsuite/src/main/org/jboss/test/ejb/passivationcl/entity/ABean.java
trunk/testsuite/src/main/org/jboss/test/ejb/passivationcl/entity/ALocal.java
trunk/testsuite/src/main/org/jboss/test/ejb/passivationcl/stateful/
trunk/testsuite/src/main/org/jboss/test/ejb/passivationcl/stateful/StatefulSession.java
trunk/testsuite/src/main/org/jboss/test/ejb/passivationcl/stateful/StatefulSessionBean.java
trunk/testsuite/src/main/org/jboss/test/ejb/passivationcl/stateful/StatefulSessionHome.java
trunk/testsuite/src/main/org/jboss/test/ejb/passivationcl/test/
trunk/testsuite/src/main/org/jboss/test/ejb/passivationcl/test/PassivationClUnitTestCase.java
trunk/testsuite/src/resources/ejb/passivationcl/
trunk/testsuite/src/resources/ejb/passivationcl/ear/
trunk/testsuite/src/resources/ejb/passivationcl/ear/META-INF/
trunk/testsuite/src/resources/ejb/passivationcl/ear/META-INF/application.xml
trunk/testsuite/src/resources/ejb/passivationcl/ear/META-INF/jboss-app.xml
trunk/testsuite/src/resources/ejb/passivationcl/stateful/
trunk/testsuite/src/resources/ejb/passivationcl/stateful/META-INF/
trunk/testsuite/src/resources/ejb/passivationcl/stateful/META-INF/ejb-jar.xml
trunk/testsuite/src/resources/ejb/passivationcl/stateful/META-INF/jboss.xml
Modified:
trunk/server/src/main/java/org/jboss/ejb/plugins/AbstractInstanceCache.java
trunk/testsuite/imports/sections/ejb.xml
trunk/testsuite/imports/test-jars.xml
Log:
JBAS-8126
Modified: trunk/server/src/main/java/org/jboss/ejb/plugins/AbstractInstanceCache.java
===================================================================
--- trunk/server/src/main/java/org/jboss/ejb/plugins/AbstractInstanceCache.java 2010-07-02 15:04:36 UTC (rev 106401)
+++ trunk/server/src/main/java/org/jboss/ejb/plugins/AbstractInstanceCache.java 2010-07-02 16:11:24 UTC (rev 106402)
@@ -203,6 +203,8 @@
if (canPassivate(ctx))
{
+ ClassLoader ccl = SecurityActions.getContextClassLoader();
+ SecurityActions.setContextClassLoader(getContainer().getClassLoader());
try
{
remove(id);
@@ -213,6 +215,10 @@
{
log.warn("failed to passivate, id="+id, ignored);
}
+ finally
+ {
+ SecurityActions.setContextClassLoader(ccl);
+ }
}
else
{
Modified: trunk/testsuite/imports/sections/ejb.xml
===================================================================
--- trunk/testsuite/imports/sections/ejb.xml 2010-07-02 15:04:36 UTC (rev 106401)
+++ trunk/testsuite/imports/sections/ejb.xml 2010-07-02 16:11:24 UTC (rev 106402)
@@ -42,4 +42,31 @@
</jar>
</target>
+ <!-- passivationcl test -->
+ <target name="_jars-passivationcl">
+ <mkdir dir="${build.lib}"/>
+ <jar destfile="${build.lib}/passivationcl_entity.jar">
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/test/ejb/passivationcl/entity/**"/>
+ </fileset>
+ </jar>
+ <jar destfile="${build.lib}/passivationcl_stateful.jar">
+ <fileset dir="${build.classes}">
+ <include name="org/jboss/test/ejb/passivationcl/stateful/**"/>
+ </fileset>
+ <fileset dir="${build.resources}/ejb/passivationcl/stateful">
+ <include name="**"/>
+ </fileset>
+ </jar>
+ <jar destfile="${build.lib}/passivationcl.ear">
+ <fileset dir="${build.resources}/ejb/passivationcl/ear">
+ <include name="META-INF/*.*"/>
+ </fileset>
+ <fileset dir="${build.lib}">
+ <include name="passivationcl_entity.jar"/>
+ <include name="passivationcl_stateful.jar"/>
+ </fileset>
+ </jar>
+ </target>
+
</project>
\ No newline at end of file
Modified: trunk/testsuite/imports/test-jars.xml
===================================================================
--- trunk/testsuite/imports/test-jars.xml 2010-07-02 15:04:36 UTC (rev 106401)
+++ trunk/testsuite/imports/test-jars.xml 2010-07-02 16:11:24 UTC (rev 106402)
@@ -114,6 +114,7 @@
_jars-entity,
_jars-ejbdepends,
_jars-entitydepends,
+ _jars-passivationcl,
_jars-entityexc,
_jars-excepiiop,
_jars-exception,
Added: trunk/testsuite/src/main/org/jboss/test/ejb/passivationcl/entity/ABean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/ejb/passivationcl/entity/ABean.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/ejb/passivationcl/entity/ABean.java 2010-07-02 16:11:24 UTC (rev 106402)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, 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.test.ejb.passivationcl.entity;
+
+import javax.ejb.Local;
+import javax.ejb.Stateless;
+
+/**
+ * A LoggerBean.
+ *
+ * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
+ * @version $Revision: 1.1 $
+ */
+ at Stateless
+ at Local(ALocal.class)
+public class ABean implements ALocal
+{
+ @Override
+ public void log()
+ {
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/ejb/passivationcl/entity/ALocal.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/ejb/passivationcl/entity/ALocal.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/ejb/passivationcl/entity/ALocal.java 2010-07-02 16:11:24 UTC (rev 106402)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, 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.test.ejb.passivationcl.entity;
+
+/**
+ * A LoggerLocal.
+ *
+ * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
+ * @version $Revision: 1.1 $
+ */
+public interface ALocal
+{
+ public void log();
+}
Added: trunk/testsuite/src/main/org/jboss/test/ejb/passivationcl/stateful/StatefulSession.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/ejb/passivationcl/stateful/StatefulSession.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/ejb/passivationcl/stateful/StatefulSession.java 2010-07-02 16:11:24 UTC (rev 106402)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, 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.test.ejb.passivationcl.stateful;
+
+import java.rmi.RemoteException;
+
+/**
+ * A MySession.
+ *
+ * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
+ * @version $Revision: 1.1 $
+ */
+public interface StatefulSession extends javax.ejb.EJBObject
+{
+ void test() throws RemoteException;
+
+ boolean isPassivated() throws RemoteException;
+}
Added: trunk/testsuite/src/main/org/jboss/test/ejb/passivationcl/stateful/StatefulSessionBean.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/ejb/passivationcl/stateful/StatefulSessionBean.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/ejb/passivationcl/stateful/StatefulSessionBean.java 2010-07-02 16:11:24 UTC (rev 106402)
@@ -0,0 +1,101 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, 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.test.ejb.passivationcl.stateful;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.EJBException;
+import javax.ejb.SessionBean;
+import javax.ejb.SessionContext;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.test.ejb.passivationcl.entity.ALocal;
+
+/**
+ * A MySessionBean.
+ *
+ * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
+ * @version $Revision: 1.1 $
+ */
+public class StatefulSessionBean implements SessionBean
+{
+ private boolean passivated;
+
+ public void test() throws RemoteException
+ {
+ Object lookup;
+ try
+ {
+ lookup = getIC().lookup("passivationcl/ABean/local");
+ }
+ catch (NamingException e)
+ {
+ throw new IllegalStateException("Failed to lookup", e);
+ }
+ ALocal.class.cast(lookup);
+ }
+
+ public void ejbCreate() throws RemoteException
+ {
+ test();
+ }
+
+ @Override
+ public void ejbActivate() throws EJBException, RemoteException
+ {
+ }
+
+ @Override
+ public void ejbPassivate() throws EJBException, RemoteException
+ {
+ passivated = true;
+ test();
+ }
+
+ public boolean isPassivated() throws RemoteException
+ {
+ return passivated;
+ }
+
+ @Override
+ public void ejbRemove() throws EJBException, RemoteException
+ {
+ }
+
+ @Override
+ public void setSessionContext(SessionContext ctx) throws EJBException, RemoteException
+ {
+ }
+
+ private InitialContext getIC()
+ {
+ try
+ {
+ return new InitialContext();
+ }
+ catch (NamingException e)
+ {
+ throw new EJBException("Failed to create InitialContext", e);
+ }
+ }
+}
Added: trunk/testsuite/src/main/org/jboss/test/ejb/passivationcl/stateful/StatefulSessionHome.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/ejb/passivationcl/stateful/StatefulSessionHome.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/ejb/passivationcl/stateful/StatefulSessionHome.java 2010-07-02 16:11:24 UTC (rev 106402)
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, 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.test.ejb.passivationcl.stateful;
+
+import java.rmi.RemoteException;
+
+import javax.ejb.CreateException;
+import javax.ejb.EJBHome;
+
+/**
+ * A MySessionHome.
+ *
+ * @author <a href="alex at jboss.com">Alexey Loubyansky</a>
+ * @version $Revision: 1.1 $
+ */
+public interface StatefulSessionHome extends EJBHome
+{
+ StatefulSession create() throws CreateException, RemoteException;
+}
Added: trunk/testsuite/src/main/org/jboss/test/ejb/passivationcl/test/PassivationClUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/ejb/passivationcl/test/PassivationClUnitTestCase.java (rev 0)
+++ trunk/testsuite/src/main/org/jboss/test/ejb/passivationcl/test/PassivationClUnitTestCase.java 2010-07-02 16:11:24 UTC (rev 106402)
@@ -0,0 +1,73 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, 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.test.ejb.passivationcl.test;
+
+import javax.rmi.PortableRemoteObject;
+
+import junit.framework.Test;
+
+import org.jboss.test.JBossTestCase;
+import org.jboss.test.ejb.passivationcl.stateful.StatefulSession;
+import org.jboss.test.ejb.passivationcl.stateful.StatefulSessionHome;
+
+/**
+ *
+ * @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
+ */
+public class PassivationClUnitTestCase extends JBossTestCase
+{
+ public PassivationClUnitTestCase(String name)
+ {
+ super(name);
+ }
+
+ public static Test suite() throws Exception
+ {
+ return getDeploySetup(PassivationClUnitTestCase.class, "passivationcl.ear");
+ }
+
+ public void testMain() throws Exception
+ {
+ Object ref = getInitialContext().lookup("StatefulSession");
+ StatefulSessionHome home = (StatefulSessionHome) PortableRemoteObject.narrow(ref, StatefulSessionHome.class);
+ StatefulSession stateful = home.create();
+ stateful.test();
+
+ int i = 5;
+ while(!stateful.isPassivated())
+ {
+ if(i == 0)
+ fail("Gave up waiting for passivation.");
+ try
+ {
+ Thread.sleep(1500);
+ }
+ catch(InterruptedException e)
+ {
+ //
+ }
+ --i;
+ }
+
+ stateful.remove();
+ }
+}
\ No newline at end of file
Added: trunk/testsuite/src/resources/ejb/passivationcl/ear/META-INF/application.xml
===================================================================
--- trunk/testsuite/src/resources/ejb/passivationcl/ear/META-INF/application.xml (rev 0)
+++ trunk/testsuite/src/resources/ejb/passivationcl/ear/META-INF/application.xml 2010-07-02 16:11:24 UTC (rev 106402)
@@ -0,0 +1,13 @@
+<application xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_6.xsd"
+ version="6">
+
+ <display-name>EJB2 passivation classloader test</display-name>
+ <module>
+ <ejb>passivationcl_entity.jar</ejb>
+ </module>
+ <module>
+ <ejb>passivationcl_stateful.jar</ejb>
+ </module>
+</application>
Added: trunk/testsuite/src/resources/ejb/passivationcl/ear/META-INF/jboss-app.xml
===================================================================
--- trunk/testsuite/src/resources/ejb/passivationcl/ear/META-INF/jboss-app.xml (rev 0)
+++ trunk/testsuite/src/resources/ejb/passivationcl/ear/META-INF/jboss-app.xml 2010-07-02 16:11:24 UTC (rev 106402)
@@ -0,0 +1,7 @@
+<!DOCTYPE jboss-app SYSTEM "http://www.jboss.org/j2ee/dtd/jboss-app_5_0.dtd">
+<jboss-app>
+ <module-order>strict</module-order>
+ <loader-repository>passivationcl.ear:loader=passivationcl.ear
+ <loader-repository-config>java2ParentDelegation=false</loader-repository-config>
+ </loader-repository>
+</jboss-app>
\ No newline at end of file
Added: trunk/testsuite/src/resources/ejb/passivationcl/stateful/META-INF/ejb-jar.xml
===================================================================
--- trunk/testsuite/src/resources/ejb/passivationcl/stateful/META-INF/ejb-jar.xml (rev 0)
+++ trunk/testsuite/src/resources/ejb/passivationcl/stateful/META-INF/ejb-jar.xml 2010-07-02 16:11:24 UTC (rev 106402)
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
+
+<ejb-jar >
+
+ <enterprise-beans>
+
+ <session>
+ <ejb-name>StatefulSession</ejb-name>
+ <home>org.jboss.test.ejb.passivationcl.stateful.StatefulSessionHome</home>
+ <remote>org.jboss.test.ejb.passivationcl.stateful.StatefulSession</remote>
+ <ejb-class>org.jboss.test.ejb.passivationcl.stateful.StatefulSessionBean</ejb-class>
+ <session-type>Stateful</session-type>
+ <transaction-type>Container</transaction-type>
+ </session>
+
+ </enterprise-beans>
+
+ <assembly-descriptor>
+ <container-transaction>
+ <method>
+ <ejb-name>StatefulSession</ejb-name>
+ <method-name>*</method-name>
+ </method>
+ <trans-attribute>RequiresNew</trans-attribute>
+ </container-transaction>
+ </assembly-descriptor>
+
+</ejb-jar>
\ No newline at end of file
Added: trunk/testsuite/src/resources/ejb/passivationcl/stateful/META-INF/jboss.xml
===================================================================
--- trunk/testsuite/src/resources/ejb/passivationcl/stateful/META-INF/jboss.xml (rev 0)
+++ trunk/testsuite/src/resources/ejb/passivationcl/stateful/META-INF/jboss.xml 2010-07-02 16:11:24 UTC (rev 106402)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.0//EN" "http://www.jboss.org/j2ee/dtd/jboss_3_0.dtd">
+
+<jboss>
+ <enterprise-beans>
+ <session>
+ <ejb-name>StatefulSession</ejb-name>
+ <jndi-name>StatefulSession</jndi-name>
+ <configuration-name>Custom Stateful</configuration-name>
+ </session>
+
+ </enterprise-beans>
+
+ <container-configurations>
+ <container-configuration extends="Standard Stateful SessionBean">
+ <container-name>Custom Stateful</container-name>
+ <container-cache-conf>
+ <cache-policy>org.jboss.ejb.plugins.LRUStatefulContextCachePolicy</cache-policy>
+ <cache-policy-conf>
+ <min-capacity>1</min-capacity>
+ <max-capacity>1</max-capacity>
+ <remover-period>1800</remover-period>
+ <max-bean-life>1800</max-bean-life>
+ <overager-period>1</overager-period>
+ <max-bean-age>1</max-bean-age>
+ <resizer-period>400</resizer-period>
+ <max-cache-miss-period>60</max-cache-miss-period>
+ <min-cache-miss-period>1</min-cache-miss-period>
+ <cache-load-factor>0.75</cache-load-factor>
+ </cache-policy-conf>
+ </container-cache-conf>
+ </container-configuration>
+ </container-configurations>
+</jboss>
More information about the jboss-cvs-commits
mailing list