User: d_jencks
Date: 01/11/11 22:52:16
Modified: src/main/org/jboss/ejb Application.java Container.java
ContainerFactory.java EntityContainer.java
MessageDrivenContainer.java
StatefulSessionContainer.java
StatelessSessionContainer.java
Log:
Changes to move toward eliminating init and destroy from Service interface, and make
J2eeDeployer use mbean-refs. (2nd try at committing - is cvs acting weird?
Revision Changes Path
1.19 +3 -28 jboss/src/main/org/jboss/ejb/Application.java
Index: Application.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/Application.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- Application.java 2001/08/30 03:10:02 1.18
+++ Application.java 2001/11/12 06:52:16 1.19
@@ -28,7 +28,7 @@
* @see ContainerFactory
*
* @author <a href="mailto:[EMAIL PROTECTED]">Rickard �berg</a>
- * @version $Revision: 1.18 $
+ * @version $Revision: 1.19 $
*/
public class Application
implements Service
@@ -183,21 +183,8 @@
}
// Service implementation ----------------------------------------
-
- /**
- * Initializes all the containers of this application.
- *
- * @exception Exception
- */
- public void init() throws Exception
- {
- Iterator enum = containers.values().iterator();
- while (enum.hasNext())
- {
- Container con = (Container)enum.next();
- con.init();
- }
- }
+ public void init() throws Exception {throw new Exception("don't call init");}
+ public void destroy(){}
/**
* Starts all the containers of this application.
@@ -227,16 +214,4 @@
}
}
- /**
- * Destroys all the containers of this application.
- */
- public void destroy()
- {
- Iterator enum = containers.values().iterator();
- while (enum.hasNext())
- {
- Container con = (Container)enum.next();
- con.destroy();
- }
- }
}
1.59 +82 -27 jboss/src/main/org/jboss/ejb/Container.java
Index: Container.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/Container.java,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- Container.java 2001/11/01 05:26:00 1.58
+++ Container.java 2001/11/12 06:52:16 1.59
@@ -6,14 +6,17 @@
*/
package org.jboss.ejb;
-import java.lang.reflect.Method;
-import java.net.URL;
+
+
+
+
+import java.lang.reflect.Method;
import java.net.MalformedURLException;
-import java.util.Iterator;
+import java.net.URL;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.Set;
-
import javax.management.Attribute;
import javax.management.AttributeList;
import javax.management.AttributeNotFoundException;
@@ -26,34 +29,33 @@
import javax.management.MBeanOperationInfo;
import javax.management.MBeanParameterInfo;
import javax.management.MBeanServer;
+import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;
import javax.management.ReflectionException;
import javax.naming.Context;
-import javax.naming.Name;
import javax.naming.InitialContext;
import javax.naming.LinkRef;
-import javax.naming.Reference;
+import javax.naming.Name;
+import javax.naming.NameNotFoundException;
import javax.naming.NamingException;
-import javax.naming.StringRefAddr;
import javax.naming.RefAddr;
-import javax.naming.NameNotFoundException;
+import javax.naming.Reference;
+import javax.naming.StringRefAddr;
import javax.transaction.TransactionManager;
-
-
+import org.jboss.deployment.DeploymentException;
import org.jboss.ejb.BeanLockManager;
+import org.jboss.ejb.plugins.local.BaseLocalContainerInvoker;
import org.jboss.logging.Logger;
+import org.jboss.metadata.ApplicationMetaData;
import org.jboss.metadata.BeanMetaData;
-import org.jboss.metadata.EnvEntryMetaData;
-import org.jboss.metadata.EjbRefMetaData;
import org.jboss.metadata.EjbLocalRefMetaData;
-import org.jboss.metadata.ResourceRefMetaData;
+import org.jboss.metadata.EjbRefMetaData;
+import org.jboss.metadata.EnvEntryMetaData;
import org.jboss.metadata.ResourceEnvRefMetaData;
-import org.jboss.metadata.ApplicationMetaData;
+import org.jboss.metadata.ResourceRefMetaData;
import org.jboss.security.EJBSecurityManager;
import org.jboss.security.RealmMapping;
-import org.jboss.ejb.plugins.local.BaseLocalContainerInvoker;
-
/**
* This is the base class for all EJB-containers in JBoss. A Container
* functions as the central hub of all metadata and plugins. Through this
@@ -72,7 +74,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Scott Stark</a>.
* @author <a href="[EMAIL PROTECTED]">Bill Burke</a>
- * @version $Revision: 1.58 $
+ * @version $Revision: 1.59 $
*
* <p><b>Revisions:</b>
*
@@ -88,6 +90,7 @@
public abstract class Container implements DynamicMBean
{
// Constants -----------------------------------------------------
+ private static final String SERVICE_CONTROLLER_NAME =
"JBOSS-SYSTEM:spine=ServiceController";
// Attributes ----------------------------------------------------
@@ -375,7 +378,7 @@
* (ClassNotFoundException) or setting up "java:"
* naming environment failed (DeploymentException)
*/
- public void init() throws Exception
+ /*public void init() throws Exception
{
// Acquire classes from CL
beanClass = classLoader.loadClass(metaData.getEjbClass());
@@ -391,7 +394,7 @@
application.addLocalHome(this, localContainerInvoker.getEJBLocalHome() );
// Setup "java:comp/env" namespace
setupEnvironment();
- }
+ }*/
/**
* A default implementation of starting the container service.
@@ -408,10 +411,27 @@
public void start()
throws Exception
{
+ // Acquire classes from CL
+ beanClass = classLoader.loadClass(metaData.getEjbClass());
+
+ if (metaData.getLocalHome() != null)
+ localHomeInterface = classLoader.loadClass(metaData.getLocalHome());
+ if (metaData.getLocal() != null)
+ localInterface = classLoader.loadClass(metaData.getLocal());
+
+ localContainerInvoker.setContainer( this );
+ //localContainerInvoker.init();
+ if (localHomeInterface != null)
+ application.addLocalHome(this, localContainerInvoker.getEJBLocalHome() );
+ // Setup "java:comp/env" namespace
+ setupEnvironment();
localContainerInvoker.start();
- String jndiName = this.getBeanMetaData().getJndiName();
- ObjectName jmxName = new ObjectName("J2EE:service=EJB,jndiName="+jndiName);
+ ObjectName jmxName = getObjectName();
mbeanServer.registerMBean(this, jmxName);
+ mbeanServer.invoke(getServiceControllerName(),
+ "registerAndStartService",
+ new Object[] {jmxName, null},
+ new String[] {"javax.management.ObjectName",
"java.lang.String"});
}
/**
@@ -424,9 +444,15 @@
localContainerInvoker.stop();
try
{
- String jndiName = this.getBeanMetaData().getJndiName();
- ObjectName jmxName = new ObjectName("J2EE:service=EJB,jndiName="+jndiName);
- mbeanServer.unregisterMBean(jmxName);
+ ObjectName jmxName = getObjectName();
+ // localContainerInvoker.destroy();
+ //mbeanServer.unregisterMBean(jmxName);
+ mbeanServer.invoke(getServiceControllerName(),
+ "undeploy",
+ new Object[] {jmxName},
+ new String[] {"javax.management.ObjectName"});
+ application.removeLocalHome( this );//???order??after undeploy?
+
}
catch(Exception e)
{
@@ -438,11 +464,12 @@
* The concrete container classes should override this method to introduce
* implementation specific destroy behaviour.
*/
+ /*
public void destroy()
{
- localContainerInvoker.destroy();
- application.removeLocalHome( this );
- }
+ //localContainerInvoker.destroy();
+ //application.removeLocalHome( this );
+ }*/
/**
* This method is called by the ContainerInvoker when a method call comes
@@ -870,4 +897,32 @@
ctx.bind(n.get(0), val);
}
+
+ private ObjectName getObjectName() throws DeploymentException
+ {
+ try
+ {
+ String jndiName = this.getBeanMetaData().getJndiName();
+ return new ObjectName("J2EE:service=EJB,jndiName="+jndiName);
+ }
+ catch (MalformedObjectNameException mone)
+ {
+ throw new DeploymentException("Can't construct container object name!!" +
mone);
+ } // end of try-catch
+
+ }
+
+
+ protected ObjectName getServiceControllerName() throws DeploymentException
+ {
+ try
+ {
+ return new ObjectName(SERVICE_CONTROLLER_NAME);
+ }
+ catch(MalformedObjectNameException mone)
+ {
+ throw new DeploymentException("Can't construct service controller object
name!!" + mone);
+ }
+ }
+
}
1.96 +46 -17 jboss/src/main/org/jboss/ejb/ContainerFactory.java
Index: ContainerFactory.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/ContainerFactory.java,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -r1.95 -r1.96
--- ContainerFactory.java 2001/10/31 02:37:55 1.95
+++ ContainerFactory.java 2001/11/12 06:52:16 1.96
@@ -68,13 +68,14 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Peter Antman</a>.
* @author <a href="mailto:[EMAIL PROTECTED]">Scott Stark</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Sacha Labourey</a>
-* @version $Revision: 1.95 $
+* @version $Revision: 1.96 $
*/
public class ContainerFactory
extends ServiceMBeanSupport
implements ContainerFactoryMBean
{
// Constants -----------------------------------------------------
+ private static final String SERVICE_CONTROLLER_NAME =
"JBOSS-SYSTEM:spine=ServiceController";
public static String DEFAULT_STATELESS_CONFIGURATION = "Default Stateless
SessionBean";
public static String DEFAULT_STATEFUL_CONFIGURATION = "Default Stateful
SessionBean";
@@ -157,20 +158,20 @@
*/
public void stopService()
{
- Iterator apps = deployments.values().iterator();
-
- while( apps.hasNext() )
+ for (Iterator apps = deployments.values().iterator(); apps.hasNext(); )
{
Application app = (Application) apps.next();
app.stop();
}
+ deployments.clear();
}
/**
* Implements the template method in superclass. This method destroys all
* the applications in this server and clears the deployments list.
*/
+ /*
public void destroyService()
{
Iterator apps = deployments.values().iterator();
@@ -184,7 +185,7 @@
deployments.clear();
}
-
+ */
/**
* Enables/disables the application bean verification upon deployment.
*
@@ -296,6 +297,7 @@
public void deploy( String appUrl, String[] jarUrls, String appId )
throws MalformedURLException, DeploymentException
{
+ getLog().info("got to deploy in ContainerFactory");
// Delegate to "real" deployment
URL[] tmp = new URL[ jarUrls.length ];
@@ -374,7 +376,7 @@
deploy( app, jarUrls[ i ], cl );
// Init application
- app.init();
+ //app.init();
// Start application
app.start();
// Startup the Management MBean Wrapper for the containers
@@ -392,7 +394,7 @@
{
log.error("Could not deploy " + appUrl.toString(), e);
app.stop();
- app.destroy();
+ //app.destroy();
throw new DeploymentException( "Could not deploy " + appUrl.toString(), e
);
}
@@ -456,16 +458,24 @@
NDC.pop();
// Get list of beans for which we will create containers
- Iterator beans = metaData.getEnterpriseBeans();
+
// Deploy beans
Context ctx = new InitialContext();
-
- while( beans.hasNext() )
+ for (Iterator beans = metaData.getEnterpriseBeans(); beans.hasNext(); )
{
BeanMetaData bean = (BeanMetaData) beans.next();
log.info( "Deploying " + bean.getEjbName() );
- app.addContainer( createContainer( bean, cl, localCl ) );
+ try
+ {
+ app.addContainer( createContainer( bean, cl, localCl ) );
+ }
+ catch (Exception e)
+ {
+ log.error("error adding container to app.", e);
+ throw e;
+ } // end of try-catch
+
}
}
@@ -496,7 +506,7 @@
handleContainerManagement( (Container) i.next(), false );
}
app.stop();
- app.destroy();
+ //app.destroy();
try {
if ( app.getClassLoader() != null ) {
// Remove from webserver
@@ -697,16 +707,24 @@
new Object[] { container },
new String[] { "org.jboss.ejb.Container" }
);
- getServer().invoke( name, "init", new Object[] {}, new String[] {} );
- getServer().invoke( name, "start", new Object[] {}, new String[] {} );
+ //getServer().invoke( name, "init", new Object[] {}, new String[] {} );
+ //getServer().invoke( name, "start", new Object[] {}, new String[] {} );
+ getServer().invoke(getServiceControllerName(),
+ "registerAndStartService",
+ new Object[] {name, null},
+ new String[] {"javax.management.ObjectName",
"java.lang.String"});
}
else
{
+ getServer().invoke(getServiceControllerName(),
+ "undeploy",
+ new Object[] {name},
+ new String[] {"javax.management.ObjectName"});
// If not startup then assume that the MBean is there
- getServer().invoke( name, "stop", new Object[] {}, new String[] {} );
- getServer().invoke( name, "destroy", new Object[] {}, new String[] {} );
+ //getServer().invoke( name, "stop", new Object[] {}, new String[] {} );
+ //getServer().invoke( name, "destroy", new Object[] {}, new String[] {}
);
// Unregister the MBean to avoid future name conflicts
- getServer().unregisterMBean( name );
+ //getServer().unregisterMBean( name );
}
}
catch( Exception e )
@@ -1002,5 +1020,16 @@
}
}
+ protected ObjectName getServiceControllerName() throws DeploymentException
+ {
+ try
+ {
+ return new ObjectName(SERVICE_CONTROLLER_NAME);
+ }
+ catch(MalformedObjectNameException mone)
+ {
+ throw new DeploymentException("Can't construct service controller object
name!!" + mone);
+ }
+ }
}
1.55 +86 -12 jboss/src/main/org/jboss/ejb/EntityContainer.java
Index: EntityContainer.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/EntityContainer.java,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -r1.54 -r1.55
--- EntityContainer.java 2001/09/01 19:50:30 1.54
+++ EntityContainer.java 2001/11/12 06:52:16 1.55
@@ -46,7 +46,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Daniel OConnor</a>
* @author <a href="[EMAIL PROTECTED]">Bill Burke</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Andreas Schaefer</a>
- * @version $Revision: 1.54 $
+ * @version $Revision: 1.55 $
*
* <p><b>Revisions:</b>
*
@@ -277,7 +277,7 @@
}
// Container implementation --------------------------------------
-
+ /*
public void init() throws Exception
{
// Associate thread with classloader
@@ -333,16 +333,66 @@
// Reset classloader
Thread.currentThread().setContextClassLoader(oldCl);
}
-
+*/
public void start() throws Exception
{
// Associate thread with classloader
ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(getClassLoader());
- // Call default start
+ // Acquire classes from CL
+ if (metaData.getHome() != null)
+ homeInterface = classLoader.loadClass(metaData.getHome());
+ if (metaData.getRemote() != null)
+ remoteInterface = classLoader.loadClass(metaData.getRemote());
+
+ // Call default init
super.start();
+ // Map the bean methods
+ setupBeanMapping();
+
+ // Map the home methods
+ setupHomeMapping();
+
+ // Initialize pool
+ instancePool.init();
+
+ // Init container invoker
+ if (containerInvoker != null)
+ containerInvoker.init();
+
+ // Init instance cache
+ instanceCache.init();
+
+ // Init persistence
+ persistenceManager.init();
+
+ // Initialize the interceptor by calling the chain
+ for (Interceptor in = interceptor; in != null; in = in.getNext())
+ {
+ in.setContainer(this);
+ in.init();
+ }
+
+ try
+ {
+ isModified = getBeanClass().getMethod("isModified", new Class[0]);
+ if (!isModified.getReturnType().equals(Boolean.TYPE))
+ isModified = null; // Has to have "boolean" as return type!
+ }
+ catch (NoSuchMethodException ignored) {}
+
+
+ // Reset classloader
+ //Thread.currentThread().setContextClassLoader(oldCl);
+ // Associate thread with classloader
+ //ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
+ //Thread.currentThread().setContextClassLoader(getClassLoader());
+
+ // Call default start
+ //super.start();
+
// Start container invoker
if (containerInvoker != null)
containerInvoker.start();
@@ -357,11 +407,9 @@
instancePool.start();
// Start all interceptors in the chain
- Interceptor in = interceptor;
- while (in != null)
+ for (Interceptor in = interceptor; in != null; in = in.getNext())
{
in.start();
- in = in.getNext();
}
// Reset classloader
@@ -391,17 +439,43 @@
instancePool.stop();
// Stop all interceptors in the chain
- Interceptor in = interceptor;
- while (in != null)
+ for (Interceptor in = interceptor; in != null; in = in.getNext())
{
in.stop();
- in = in.getNext();
+ }
+
+ // Reset classloader
+ //Thread.currentThread().setContextClassLoader(oldCl);
+ // Associate thread with classloader
+ //ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
+ //Thread.currentThread().setContextClassLoader(getClassLoader());
+
+ // Call default destroy
+ //super.destroy();
+
+ // Destroy container invoker
+ if (containerInvoker != null)
+ containerInvoker.destroy();
+
+ // Destroy instance cache
+ instanceCache.destroy();
+
+ // Destroy persistence
+ persistenceManager.destroy();
+
+ // Destroy the pool
+ instancePool.destroy();
+
+ // Destroy all the interceptors in the chain
+ for (Interceptor in = interceptor; in != null; in = in.getNext())
+ {
+ in.destroy();
}
// Reset classloader
Thread.currentThread().setContextClassLoader(oldCl);
}
-
+ /*
public void destroy()
{
// Associate thread with classloader
@@ -435,7 +509,7 @@
// Reset classloader
Thread.currentThread().setContextClassLoader(oldCl);
}
-
+ */
public Object invokeHome(MethodInvocation mi) throws Exception
{
return getInterceptor().invokeHome(mi);
1.14 +63 -15 jboss/src/main/org/jboss/ejb/MessageDrivenContainer.java
Index: MessageDrivenContainer.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/MessageDrivenContainer.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- MessageDrivenContainer.java 2001/09/11 18:34:59 1.13
+++ MessageDrivenContainer.java 2001/11/12 06:52:16 1.14
@@ -32,7 +32,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Daniel OConnor</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Jason Dillon</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Scott Stark</a>
- * @version $Revision: 1.13 $
+ * @version $Revision: 1.14 $
*/
public class MessageDrivenContainer
extends Container
@@ -144,7 +144,7 @@
}
// Container implementation - overridden here ----------------------
-
+ /*
public void init() throws Exception
{
try {
@@ -180,16 +180,47 @@
throw e;
}
}
-
- public void start()
+*/
+ public void start()
throws Exception
{
+ ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
+ try {
+ // Associate thread with classloader
+ Thread.currentThread().setContextClassLoader(getClassLoader());
+
+ // Call default init
+ super.start();
+
+ // Map the bean methods
+ setupBeanMapping();
+
+ // Initialize pool
+ instancePool.init();
+
+ // Init container invoker
+ containerInvoker.init();
+
+ // Initialize the interceptor by calling the chain
+ for (Interceptor in = interceptor; in != null; in = in.getNext())
+ {
+ in.setContainer(this);
+ in.init();
+ }
+
+ // Reset classloader
+ //Thread.currentThread().setContextClassLoader(oldCl);
+ }
+ catch (Exception e) {
+ log.error("Serious error in init: ", e);
+ throw e;
+ }
// Associate thread with classloader
- ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
- Thread.currentThread().setContextClassLoader(getClassLoader());
+ //ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
+ //Thread.currentThread().setContextClassLoader(getClassLoader());
// Call default start
- super.start();
+ //super.start();
// Start container invoker
containerInvoker.start();
@@ -197,11 +228,9 @@
instancePool.start();
// Start all interceptors in the chain
- Interceptor in = interceptor;
- while (in != null)
+ for (Interceptor in = interceptor; in != null; in = in.getNext())
{
in.start();
- in = in.getNext();
}
// Reset classloader
@@ -224,17 +253,36 @@
instancePool.stop();
// Stop all interceptors in the chain
- Interceptor in = interceptor;
- while (in != null)
+ for (Interceptor in = interceptor; in != null; in = in.getNext())
{
in.stop();
- in = in.getNext();
}
// Reset classloader
+ //Thread.currentThread().setContextClassLoader(oldCl);
+ // Associate thread with classloader
+ //ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
+ //Thread.currentThread().setContextClassLoader(getClassLoader());
+
+ // Call default destroy
+ //super.destroy();
+
+ // Destroy container invoker
+ containerInvoker.destroy();
+
+ // Destroy the pool
+ instancePool.destroy();
+
+ // Destroy all the interceptors in the chain
+ for (Interceptor in = interceptor; in != null; in = in.getNext())
+ {
+ in.destroy();
+ }
+
+ // Reset classloader
Thread.currentThread().setContextClassLoader(oldCl);
}
-
+ /*
public void destroy()
{
// Associate thread with classloader
@@ -261,7 +309,7 @@
// Reset classloader
Thread.currentThread().setContextClassLoader(oldCl);
}
-
+*/
public Object invokeHome(MethodInvocation mi)
throws Exception
1.36 +78 -13 jboss/src/main/org/jboss/ejb/StatefulSessionContainer.java
Index: StatefulSessionContainer.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/StatefulSessionContainer.java,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- StatefulSessionContainer.java 2001/10/30 20:09:20 1.35
+++ StatefulSessionContainer.java 2001/11/12 06:52:16 1.36
@@ -34,7 +34,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Rickard �berg</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Daniel OConnor</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
- * @version $Revision: 1.35 $
+ * @version $Revision: 1.36 $
*
* <p><b>Revisions</b>
* <p><b>20010704</b>
@@ -182,7 +182,7 @@
}
// Container implementation --------------------------------------
-
+ /*
public void init() throws Exception
{
// Associate thread with classloader
@@ -229,16 +229,57 @@
// Reset classloader
Thread.currentThread().setContextClassLoader(oldCl);
}
-
+ */
+ //remove the init calls another day.
public void start() throws Exception
{
- // Associate thread with classloader
ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(getClassLoader());
- // Call default start
+ // Acquire classes from CL
+ if (metaData.getHome() != null)
+ homeInterface = classLoader.loadClass(metaData.getHome());
+ if (metaData.getRemote() != null)
+ remoteInterface = classLoader.loadClass(metaData.getRemote());
+
+ // Call default init
super.start();
+ // Map the bean methods
+ setupBeanMapping();
+
+ // Map the home methods
+ setupHomeMapping();
+
+ // Init container invoker
+ if (containerInvoker != null)
+ containerInvoker.init();
+
+ // Init instance cache
+ instanceCache.init();
+
+ // Initialize pool
+ instancePool.init();
+
+ // Init persistence
+ persistenceManager.init();
+
+ // Initialize the interceptor by calling the chain
+ for (Interceptor in = interceptor; in != null; in = in.getNext())
+ {
+ in.setContainer(this);
+ in.init();
+ }
+
+ // Reset classloader
+ //Thread.currentThread().setContextClassLoader(oldCl);
+ // Associate thread with classloader
+ // ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
+ //Thread.currentThread().setContextClassLoader(getClassLoader());
+
+ // Call default start
+ //super.start();
+
// Start container invoker
if (containerInvoker != null)
containerInvoker.start();
@@ -253,11 +294,9 @@
persistenceManager.start();
// Start all interceptors in the chain
- Interceptor in = interceptor;
- while (in != null)
+ for (Interceptor in = interceptor; in != null; in = in.getNext())
{
in.start();
- in = in.getNext();
}
// Reset classloader
@@ -290,17 +329,43 @@
instancePool.stop();
// Stop all interceptors in the chain
- Interceptor in = interceptor;
- while (in != null)
+ for (Interceptor in = interceptor; in != null; in = in.getNext())
{
in.stop();
- in = in.getNext();
+ }
+
+ // Reset classloader
+ //Thread.currentThread().setContextClassLoader(oldCl);
+ // Associate thread with classloader
+ //ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
+ //Thread.currentThread().setContextClassLoader(getClassLoader());
+
+ // Call default destroy
+ //super.destroy();
+
+ // Destroy container invoker
+ if (containerInvoker != null)
+ containerInvoker.destroy();
+
+ // Destroy instance cache
+ instanceCache.destroy();
+
+ // Destroy pool
+ instancePool.destroy();
+
+ // Destroy persistence
+ persistenceManager.destroy();
+
+ // Destroy all the interceptors in the chain
+ for (Interceptor in = interceptor; in != null; in = in.getNext())
+ {
+ in.destroy();
}
// Reset classloader
Thread.currentThread().setContextClassLoader(oldCl);
}
-
+ /*
public void destroy()
{
// Associate thread with classloader
@@ -334,7 +399,7 @@
// Reset classloader
Thread.currentThread().setContextClassLoader(oldCl);
}
-
+ */
public Object invokeHome(MethodInvocation mi)
throws Exception
{
1.27 +66 -12 jboss/src/main/org/jboss/ejb/StatelessSessionContainer.java
Index: StatelessSessionContainer.java
===================================================================
RCS file:
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/StatelessSessionContainer.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- StatelessSessionContainer.java 2001/09/11 18:34:59 1.26
+++ StatelessSessionContainer.java 2001/11/12 06:52:16 1.27
@@ -30,7 +30,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Rickard �berg</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Daniel OConnor</a>
- * @version $Revision: 1.26 $
+ * @version $Revision: 1.27 $
*/
public class StatelessSessionContainer
extends Container
@@ -137,7 +137,7 @@
// Container implementation --------------------------------------
-
+ /*
public void init() throws Exception
{
// Associate thread with classloader
@@ -178,16 +178,52 @@
// Reset classloader
Thread.currentThread().setContextClassLoader(oldCl);
}
-
+ */
public void start() throws Exception
{
// Associate thread with classloader
ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(getClassLoader());
- // Call default start
+ // Acquire classes from CL
+ if (metaData.getHome() != null)
+ homeInterface = classLoader.loadClass(metaData.getHome());
+ if (metaData.getRemote() != null)
+ remoteInterface = classLoader.loadClass(metaData.getRemote());
+
+ // Call default init
super.start();
+ // Map the bean methods
+ setupBeanMapping();
+
+ // Map the home methods
+ setupHomeMapping();
+
+ // Initialize pool
+ instancePool.init();
+
+ // Init container invoker
+ if (containerInvoker != null)
+ containerInvoker.init();
+
+ // Initialize the interceptor by calling the chain
+
+ for (Interceptor in = interceptor; in != null; in = in.getNext())
+ {
+ in.setContainer(this);
+ in.init();
+ }
+
+ // Reset classloader
+ //Thread.currentThread().setContextClassLoader(oldCl);
+ // Associate thread with classloader
+ //ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
+ //Thread.currentThread().setContextClassLoader(getClassLoader());
+
+ // Call default start
+ //super.start();
+
// Start container invoker
if (containerInvoker != null)
containerInvoker.start();
@@ -196,11 +232,9 @@
instancePool.start();
// Start all interceptors in the chain
- Interceptor in = interceptor;
- while (in != null)
+ for (Interceptor in = interceptor; in != null; in = in.getNext())
{
in.start();
- in = in.getNext();
}
// Reset classloader
@@ -224,17 +258,37 @@
instancePool.stop();
// Stop all interceptors in the chain
- Interceptor in = interceptor;
- while (in != null)
+ for (Interceptor in = interceptor; in != null; in = in.getNext())
{
in.stop();
- in = in.getNext();
}
// Reset classloader
+ //Thread.currentThread().setContextClassLoader(oldCl);
+ // Associate thread with classloader
+ //ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
+ //Thread.currentThread().setContextClassLoader(getClassLoader());
+
+ // Call default destroy
+ //super.destroy();
+
+ // Destroy container invoker
+ if (containerInvoker != null)
+ containerInvoker.destroy();
+
+ // Destroy the pool
+ instancePool.destroy();
+
+ // Destroy all the interceptors in the chain
+ for (Interceptor in = interceptor; in != null; in = in.getNext())
+ {
+ in.destroy();
+ }
+
+ // Reset classloader
Thread.currentThread().setContextClassLoader(oldCl);
}
-
+ /*
public void destroy()
{
// Associate thread with classloader
@@ -262,7 +316,7 @@
// Reset classloader
Thread.currentThread().setContextClassLoader(oldCl);
}
-
+ */
public Object invokeHome(MethodInvocation mi) throws Exception
{
return getInterceptor().invokeHome(mi);
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development