[prev in list] [next in list] [prev in thread] [next in thread]
List: jboss-cvs-commits
Subject: [jboss-cvs] jboss/src/main/org/jboss/ejb SessionContainer.java Container.java EJBDeployer.java Entit
From: "Dr. Christoph Georg Jung" <cgjung () users ! sourceforge ! net>
Date: 2003-10-31 18:23:49
[Download RAW message or body]
User: cgjung
Date: 03/10/31 10:23:49
Modified: src/main/org/jboss/ejb Container.java EJBDeployer.java
EntityEnterpriseContext.java
StatefulSessionContainer.java
StatelessSessionContainer.java
Added: src/main/org/jboss/ejb SessionContainer.java
Log:
Initial (working) J2EE1.4/WS4EE1.0 bits (see ChangeNote).
Revision Changes Path
1.124 +5 -2 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.123
retrieving revision 1.124
diff -u -r1.123 -r1.124
--- Container.java 27 Aug 2003 04:31:59 -0000 1.123
+++ Container.java 31 Oct 2003 18:23:49 -0000 1.124
@@ -65,7 +65,8 @@
* @author <a href="mailto:Scott.Stark@jboss.org">Scott Stark</a>.
* @author <a href="bill@burkecentral.com">Bill Burke</a>
* @author <a href="mailto:d_jencks@users.sourceforge.net">David Jencks</a>
- * @version $Revision: 1.123 $
+ * @author <a href="mailto:christoph.jung@infor.de">Christoph G. Jung</a>
+ * @version $Revision: 1.124 $
*
* @jmx:mbean extends="org.jboss.system.ServiceMBean"
*/
@@ -682,7 +683,9 @@
this.invokeStats.callIn();
if(type == InvocationType.REMOTE ||
- type == InvocationType.LOCAL)
+ type == InvocationType.LOCAL ||
+ // web service calls come in as "ordinary" application \
invocations + type == InvocationType.SERVICE_ENDPOINT)
{
if (mi instanceof MarshalledInvocation)
{
1.39 +13 -2 jboss/src/main/org/jboss/ejb/EJBDeployer.java
Index: EJBDeployer.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/EJBDeployer.java,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- EJBDeployer.java 5 Oct 2003 22:44:05 -0000 1.38
+++ EJBDeployer.java 31 Oct 2003 18:23:49 -0000 1.39
@@ -45,7 +45,7 @@
*
* @see Container
*
- * @version <tt>$Revision: 1.38 $</tt>
+ * @version <tt>$Revision: 1.39 $</tt>
* @author <a href="mailto:rickard.oberg@telkel.com">Rickard Öberg</a>
* @author <a href="mailto:marc.fleury@telkel.com">Marc Fleury</a>
* @author <a href="mailto:jplindfo@helsinki.fi">Juha Lindfors</a>
@@ -54,6 +54,7 @@
* @author <a href="mailto:scott.stark@jboss.org">Scott Stark</a>
* @author <a href="mailto:sacha.labourey@cogito-info.ch">Sacha Labourey</a>
* @author <a href="mailto:jason@planet57.com">Jason Dillon</a>
+ * @author <a href="mailto:christoph.jung@infor.de">Christoph G. Jung</a>
*/
public class EJBDeployer
extends SubDeployerSupport
@@ -412,8 +413,11 @@
super.init(di);
}
- /** This is here as a reminder that we may not want to allow ejb jars to
+ /**
+ * This is here as a reminder that we may not want to allow ejb jars to
* have arbitrary sub deployments. Currently we do.
+ * It is also here as a temporary solution to get JSR-109 simultaneous
+ * web service deployments going
* @param di
* @throws DeploymentException
*/
@@ -421,6 +425,13 @@
throws DeploymentException
{
super.processNestedDeployments(di);
+ // look for web service deployments
+ URL webServiceUrl=di.localCl.getResource("META-INF/webservices.xml");
+ if(webServiceUrl!=null) {
+ DeploymentInfo sub=new DeploymentInfo(webServiceUrl,di,getServer());
+ sub.localCl=di.localCl;
+ sub.localUrl=di.localUrl;
+ }
}
public synchronized void create(DeploymentInfo di)
1.35 +2 -2 jboss/src/main/org/jboss/ejb/EntityEnterpriseContext.java
Index: EntityEnterpriseContext.java
===================================================================
RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/EntityEnterpriseContext.java,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- EntityEnterpriseContext.java 27 Aug 2003 04:31:59 -0000 1.34
+++ EntityEnterpriseContext.java 31 Oct 2003 18:23:49 -0000 1.35
@@ -28,7 +28,7 @@
* @author <a href="mailto:rickard.oberg@telkel.com">Rickard �berg</a>
* @author <a href="mailto:marc.fleury@telkel.com">Marc Fleury</a>
* @author <a href="mailto:docodan@mvcsoft.com">Daniel OConnor</a>
- * @version $Revision: 1.34 $
+ * @version $Revision: 1.35 $
*/
public class EntityEnterpriseContext extends EnterpriseContext
{
@@ -196,7 +196,7 @@
if(proxyFactory == null)
{
String defaultInvokerName = con.getBeanMetaData().
- getContainerConfiguration().getDefaultInvokerName();
+ getContainerConfiguration().getInvokers()[0];
proxyFactory = con.lookupProxyFactory(defaultInvokerName);
}
ejbObject = (EJBObject)proxyFactory.getEntityEJBObject(cacheKey);
1.62 +53 -476 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.61
retrieving revision 1.62
diff -u -r1.61 -r1.62
--- StatefulSessionContainer.java 25 Oct 2003 15:12:40 -0000 1.61
+++ StatefulSessionContainer.java 31 Oct 2003 18:23:49 -0000 1.62
@@ -11,72 +11,43 @@
import java.lang.reflect.InvocationTargetException;
import java.util.Map;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.Hashtable;
import java.rmi.RemoteException;
-import javax.ejb.Handle;
import javax.ejb.HomeHandle;
import javax.ejb.EJBObject;
import javax.ejb.EJBLocalObject;
-import javax.ejb.EJBLocalHome;
-import javax.ejb.EJBHome;
import javax.ejb.EJBMetaData;
import javax.ejb.RemoveException;
import javax.ejb.EJBException;
import javax.management.ObjectName;
import org.jboss.invocation.Invocation;
-import org.jboss.invocation.MarshalledInvocation;
/**
* The container for <em>stateful</em> session beans.
*
- * @author <a href="mailto:rickard.oberg@telkel.com">Rickard Öberg</a>
+ * @author <a href="mailto:rickard.oberg@telkel.com">Rickard Öberg</a>
* @author <a href="mailto:docodan@mvcsoft.com">Daniel OConnor</a>
* @author <a href="mailto:marc.fleury@jboss.org">Marc Fleury</a>
* @author <a href="mailto:scott.stark@jboss.org">Scott Stark</a>
* @author <a href="mailto:jason@planet57.com">Jason Dillon</a>
- * @version <tt>$Revision: 1.61 $</tt>
+ * @author <a href="mailto:Christoph.Jung@infor.de">Christoph G. Jung</a>
+ * @version <tt>$Revision: 1.62 $</tt>
*
* @jmx:mbean extends="org.jboss.ejb.ContainerMBean"
*/
+
public class StatefulSessionContainer
- extends Container
+ extends SessionContainer
implements EJBProxyFactoryContainer, InstancePoolContainer
{
- /**
- * These are the mappings between the home interface methods and the
- * container methods.
- */
- protected Map homeMapping;
-
- /**
- * These are the mappings between the remote interface methods and the
- * bean methods.
- */
- protected Map beanMapping;
-
- /**
- * This is the first interceptor in the chain. The last interceptor must
- * be provided by the container itself.
- */
- protected Interceptor interceptor;
-
- /** This is the instancepool that is to be used */
- protected InstancePool instancePool;
-
/** This is the persistence manager for this container */
protected StatefulSessionPersistenceManager persistenceManager;
/** The instance cache. */
protected InstanceCache instanceCache;
- public LocalProxyFactory getLocalProxyFactory()
- {
- return localProxyFactory;
- }
-
public void setInstanceCache(InstanceCache ic)
{
this.instanceCache = ic;
@@ -88,20 +59,6 @@
return instanceCache;
}
- public void setInstancePool(InstancePool ip)
- {
- if (ip == null)
- throw new IllegalArgumentException("Null pool");
-
- this.instancePool = ip;
- ip.setContainer(this);
- }
-
- public InstancePool getInstancePool()
- {
- return instancePool;
- }
-
public StatefulSessionPersistenceManager getPersistenceManager()
{
return persistenceManager;
@@ -113,309 +70,75 @@
pm.setContainer(this);
}
- public void addInterceptor(Interceptor in)
- {
- if (interceptor == null)
+ // Container implementation --------------------------------------
+
+ /** creates and registers the instance cache */
+ protected void createInstanceCache() throws Exception {
+ // Init instance cache
+ instanceCache.create();
+ // Try to register the instance cache as an MBean
+ try
{
- interceptor = in;
+ ObjectName containerName = super.getJmxName();
+ Hashtable props = containerName.getKeyPropertyList();
+ props.put("plugin", "cache");
+ ObjectName cacheName = new ObjectName(containerName.getDomain(), props);
+ server.registerMBean(instanceCache, cacheName);
}
- else
+ catch(Throwable t)
{
- Interceptor current = interceptor;
- while ( current.getNext() != null)
- {
- current = current.getNext();
- }
-
- current.setNext(in);
+ log.debug("Failed to register cache as mbean", t);
}
}
- public Interceptor getInterceptor()
- {
- return interceptor;
+ /** create persistence manager */
+ protected void createPersistenceManager() throws Exception {
+ persistenceManager.create();
}
- public Class getHomeClass()
- {
- return homeInterface;
+ /** Start persistence */
+ protected void startPersistenceManager() throws Exception {
+ persistenceManager.start();
}
- public Class getRemoteClass()
- {
- return remoteInterface;
+ /** Start instance cache */
+ protected void startInstanceCache() throws Exception {
+ instanceCache.start();
}
- // Container implementation --------------------------------------
-
- protected void createService() throws Exception
- {
- // Associate thread with classloader
- ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
- Thread.currentThread().setContextClassLoader(getClassLoader());
-
- try
- {
- // 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.createService();
-
- // Make some additional validity checks with regards to the container \
configuration
- checkCoherency ();
-
- // Map the bean methods
- setupBeanMapping();
-
- // Map the home methods
- setupHomeMapping();
-
- // Map the interfaces to Long
- setupMarshalledInvocationMapping();
-
- // Init container invoker
- for (Iterator it = proxyFactories.keySet().iterator(); it.hasNext(); )
- {
- String invokerBinding = (String)it.next();
- EJBProxyFactory ci = \
(EJBProxyFactory)proxyFactories.get(invokerBinding);
- ci.create();
- }
-
- // Init instance cache
- instanceCache.create();
- // Try to register the instance cache as an MBean
- try
- {
- ObjectName containerName = super.getJmxName();
- Hashtable props = containerName.getKeyPropertyList();
- props.put("plugin", "cache");
- ObjectName cacheName = new ObjectName(containerName.getDomain(), \
props);
- server.registerMBean(instanceCache, cacheName);
- }
- catch(Throwable t)
- {
- log.debug("Failed to register cache as mbean", t);
- }
-
- // Initialize pool
- instancePool.create();
- // Try to register the instance pool as an MBean
- try
- {
- ObjectName containerName = super.getJmxName();
- Hashtable props = containerName.getKeyPropertyList();
- props.put("plugin", "pool");
- ObjectName poolName = new ObjectName(containerName.getDomain(), \
props);
- server.registerMBean(instancePool, poolName);
- }
- catch(Throwable t)
- {
- log.debug("Failed to register pool as mbean", t);
- }
-
- // Init persistence
- persistenceManager.create();
-
- // Initialize the interceptor by calling the chain
- Interceptor in = interceptor;
- while (in != null)
- {
- in.setContainer(this);
- in.create();
- in = in.getNext();
- }
- }
- finally
- {
- // Reset classloader
- Thread.currentThread().setContextClassLoader(oldCl);
- }
+ /** Stop persistence */
+ protected void stopPersistenceManager() {
+ persistenceManager.stop();
}
- protected void startService() throws Exception
- {
- // Associate thread with classloader
- ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
- Thread.currentThread().setContextClassLoader(getClassLoader());
-
- try
- {
- // Call default start
- super.startService();
-
- // Start container invoker
- for (Iterator it = proxyFactories.keySet().iterator(); it.hasNext(); )
- {
- String invokerBinding = (String)it.next();
- EJBProxyFactory ci = \
(EJBProxyFactory)proxyFactories.get(invokerBinding);
- ci.start();
- }
-
- // Start instance cache
- instanceCache.start();
-
- // Start pool
- instancePool.start();
-
- // Start persistence
- persistenceManager.start();
-
- // Start all interceptors in the chain
- Interceptor in = interceptor;
- while (in != null)
- {
- in.start();
- in = in.getNext();
- }
- }
- finally
- {
- // Reset classloader
- Thread.currentThread().setContextClassLoader(oldCl);
- }
+ /** Stop instance cache */
+ protected void stopInstanceCache() {
+ instanceCache.stop();
}
- protected void stopService() throws Exception
- {
- // Associate thread with classloader
- ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
- Thread.currentThread().setContextClassLoader(getClassLoader());
-
- try
- {
- // Call default stop
- super.stopService();
-
- // Stop container invoker
- for (Iterator it = proxyFactories.keySet().iterator(); it.hasNext(); )
- {
- String invokerBinding = (String)it.next();
- EJBProxyFactory ci = \
(EJBProxyFactory)proxyFactories.get(invokerBinding);
- ci.stop();
- }
-
- // Stop instance cache
- instanceCache.stop();
-
- // Stop pool
- instancePool.stop();
-
- // Stop persistence
- persistenceManager.stop();
-
- // Stop the instance pool
- instancePool.stop();
-
- // Stop all interceptors in the chain
- Interceptor in = interceptor;
- while (in != null)
- {
- in.stop();
- in = in.getNext();
- }
- }
- finally
- {
- // Reset classloader
- Thread.currentThread().setContextClassLoader(oldCl);
- }
+ protected void destroyPersistenceManager() {
+ // Destroy persistence
+ persistenceManager.destroy();
+ persistenceManager.setContainer(null);
}
- protected void destroyService() throws Exception
- {
- // Associate thread with classloader
- ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
- Thread.currentThread().setContextClassLoader(getClassLoader());
-
+ protected void destroyInstanceCache() {
+ // Destroy instance cache
+ instanceCache.destroy();
+ instanceCache.setContainer(null);
try
{
- // Destroy container invoker
- for (Iterator it = proxyFactories.keySet().iterator(); it.hasNext(); )
- {
- String invokerBinding = (String)it.next();
- EJBProxyFactory ci = \
(EJBProxyFactory)proxyFactories.get(invokerBinding);
- ci.destroy();
- ci.setContainer(null);
- }
-
- // Destroy instance cache
- instanceCache.destroy();
- instanceCache.setContainer(null);
- try
- {
- ObjectName containerName = super.getJmxName();
- Hashtable props = containerName.getKeyPropertyList();
- props.put("plugin", "cache");
- ObjectName cacheName = new ObjectName(containerName.getDomain(), \
props);
- server.unregisterMBean(cacheName);
- }
- catch(Throwable ignore)
- {
- }
-
- // Destroy pool
- instancePool.destroy();
- instancePool.setContainer(null);
- try
- {
- ObjectName containerName = super.getJmxName();
- Hashtable props = containerName.getKeyPropertyList();
- props.put("plugin", "pool");
- ObjectName poolName = new ObjectName(containerName.getDomain(), \
props);
- server.unregisterMBean(poolName);
- }
- catch(Throwable ignore)
- {
- }
-
- // Destroy persistence
- persistenceManager.destroy();
- persistenceManager.setContainer(null);
-
- // Destroy all the interceptors in the chain
- Interceptor in = interceptor;
- while (in != null)
- {
- in.destroy();
- in.setContainer(null);
- in = in.getNext();
- }
-
- MarshalledInvocation.removeHashes(homeInterface);
- MarshalledInvocation.removeHashes(remoteInterface);
-
- // Call default destroy
- super.destroyService();
+ ObjectName containerName = super.getJmxName();
+ Hashtable props = containerName.getKeyPropertyList();
+ props.put("plugin", "cache");
+ ObjectName cacheName = new ObjectName(containerName.getDomain(), props);
+ server.unregisterMBean(cacheName);
}
- finally
+ catch(Throwable ignore)
{
- // Reset classloader
- Thread.currentThread().setContextClassLoader(oldCl);
}
}
- public Object internalInvokeHome(Invocation mi)
- throws Exception
- {
- return getInterceptor().invokeHome(mi);
- }
-
- /**
- * This method retrieves the instance from an object table, and invokes
- * the method on the particular instance through the chain of interceptors.
- */
- public Object internalInvoke(Invocation mi)
- throws Exception
- {
-
- // Invoke through interceptors
- return getInterceptor().invoke(mi);
- }
-
// EJBObject implementation --------------------------------------
public void remove(Invocation mi)
@@ -440,48 +163,6 @@
removeCount ++;
}
- /**
- * While the following methods are implemented in the client in the case
- * of JRMP we would need to implement them to fully support other transport
- * protocols
- *
- * @return Always null
- */
- public Handle getHandle(Invocation mi) throws RemoteException
- {
- // TODO
- return null;
- }
-
- /**
- * @return Always null
- */
- public Object getPrimaryKey(Invocation mi) throws RemoteException
- {
- // TODO
- return null;
- }
-
- public EJBHome getEJBHome(Invocation mi) throws RemoteException
- {
- EJBProxyFactory ci = getProxyFactory();
- if (ci == null)
- {
- String msg = "No ProxyFactory, check for ProxyFactoryFinderInterceptor";
- throw new IllegalStateException(msg);
- }
-
- return (EJBHome) ci.getEJBHome();
- }
-
- /**
- * @return Always false
- */
- public boolean isIdentical(Invocation mi) throws RemoteException
- {
- return false; // TODO
- }
-
// Home interface implementation ---------------------------------
private void createSession(final Method m,
@@ -567,12 +248,6 @@
return ((StatefulSessionEnterpriseContext)mi.getEnterpriseContext()).getEJBObject();
}
- // local object interface implementation
-
- public EJBLocalHome getEJBLocalHome(Invocation mi)
- {
- return localProxyFactory.getEJBLocalHome();
- }
// local home interface implementation
@@ -745,109 +420,11 @@
homeMapping = map;
}
-
- private void setUpBeanMappingImpl(Map map,
- Method[] m,
- String declaringClass)
- throws NoSuchMethodException
- {
- for (int i = 0; i < m.length; i++)
- {
- if (!m[i].getDeclaringClass().getName().equals(declaringClass))
- {
- // Implemented by bean
- map.put(m[i], beanClass.getMethod(m[i].getName(),
- m[i].getParameterTypes()));
- }
- else
- {
- try
- {
- // Implemented by container
- map.put(m[i], getClass().getMethod(m[i].getName(),
- new Class[]
- { Invocation.class }));
- } catch (NoSuchMethodException e)
- {
- log.error(m[i].getName() + " in bean has not been mapped", e);
- }
- }
- }
- }
-
- protected void setupBeanMapping() throws NoSuchMethodException
- {
- Map map = new HashMap();
-
- if (remoteInterface != null)
- {
- Method[] m = remoteInterface.getMethods();
- setUpBeanMappingImpl( map, m, "javax.ejb.EJBObject" );
- }
-
- if (localInterface != null)
- {
- Method[] m = localInterface.getMethods();
- setUpBeanMappingImpl( map, m, "javax.ejb.EJBLocalObject" );
- }
-
- beanMapping = map;
- }
-
- protected void setupMarshalledInvocationMapping() throws Exception
- {
- // Create method mappings for container invoker
- if (homeInterface != null)
- {
- Method [] m = homeInterface.getMethods();
- for (int i = 0 ; i<m.length ; i++)
- {
- marshalledInvocationMapping.put( new \
Long(MarshalledInvocation.calculateHash(m[i])), m[i]);
- }
- }
-
- if (remoteInterface != null)
- {
- Method [] m = remoteInterface.getMethods();
- for (int j = 0 ; j<m.length ; j++)
- {
- marshalledInvocationMapping.put( new \
Long(MarshalledInvocation.calculateHash(m[j])), m[j]);
- }
- }
- // Get the getEJBObjectMethod
- Method getEJBObjectMethod = \
Class.forName("javax.ejb.Handle").getMethod("getEJBObject", new \
Class[0]);
-
- // Hash it
- marshalledInvocationMapping.put(new \
Long(MarshalledInvocation.calculateHash(getEJBObjectMethod)),getEJBObjectMethod);
- }
-
protected Interceptor createContainerInterceptor()
{
return new ContainerInterceptor();
}
- protected void checkCoherency () throws Exception
- {
- // Check clustering cohrency wrt metadata
- //
- if (metaData.isClustered())
- {
- boolean clusteredProxyFactoryFound = false;
- for (Iterator it = proxyFactories.keySet().iterator(); it.hasNext(); )
- {
- String invokerBinding = (String)it.next();
- EJBProxyFactory ci = \
(EJBProxyFactory)proxyFactories.get(invokerBinding);
- if (ci instanceof org.jboss.proxy.ejb.ClusterProxyFactory)
- clusteredProxyFactoryFound = true;
- }
-
- if (!clusteredProxyFactoryFound)
- {
- log.warn("*** EJB '" + this.metaData.getEjbName() + "' deployed as \
CLUSTERED but not a single clustered-invoker is bound to container \
***");
- }
- }
- }
-
/**
* This is the last step before invocation - all interceptors are done
*/
@@ -864,11 +441,11 @@
log.trace(""+mi.getMethod());
log.trace("HOMEMETHOD coming in hashcode"+mi.getMethod().hashCode());
log.trace("HOMEMETHOD coming in \
classloader"+mi.getMethod().getDeclaringClass().getClassLoader().hashCode());
- log.trace("CONTAINS "+homeMapping.containsKey(mi.getMethod()));
+ log.trace("CONTAINS "+getHomeMapping().containsKey(mi.getMethod()));
}
Method miMethod = mi.getMethod();
- Method m = (Method) homeMapping.get(miMethod);
+ Method m = (Method) getHomeMapping().get(miMethod);
if( m == null )
{
String msg = "Invalid invocation, check your deployment packaging"
@@ -880,7 +457,7 @@
if (trace)
{
log.trace("HOMEMETHOD m "+m);
- java.util.Iterator iterator = homeMapping.keySet().iterator();
+ java.util.Iterator iterator = getHomeMapping().keySet().iterator();
while(iterator.hasNext())
{
Method me = (Method) iterator.next();
@@ -918,7 +495,7 @@
// Get method
Method miMethod = mi.getMethod();
- Method m = (Method) beanMapping.get(miMethod);
+ Method m = (Method) getBeanMapping().get(miMethod);
if( m == null )
{
String msg = "Invalid invocation, check your deployment packaging"
1.49 +5 -455 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.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- StatelessSessionContainer.java 27 Aug 2003 04:32:00 -0000 1.48
+++ StatelessSessionContainer.java 31 Oct 2003 18:23:49 -0000 1.49
@@ -10,24 +10,18 @@
import java.lang.reflect.Method;
import java.util.Map;
import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Hashtable;
import java.rmi.RemoteException;
import javax.ejb.Handle;
import javax.ejb.HomeHandle;
import javax.ejb.EJBObject;
-import javax.ejb.EJBHome;
import javax.ejb.EJBLocalObject;
-import javax.ejb.EJBLocalHome;
import javax.ejb.EJBMetaData;
import javax.ejb.CreateException;
import javax.ejb.RemoveException;
import javax.ejb.EJBException;
-import javax.management.ObjectName;
import org.jboss.invocation.Invocation;
-import org.jboss.invocation.MarshalledInvocation;
/**
* The container for <em>stateless</em> session beans.
@@ -35,302 +29,13 @@
* @author <a href="mailto:rickard.oberg@telkel.com">Rickard Öberg</a>
* @author <a href="mailto:marc.fleury@telkel.com">Marc Fleury</a>
* @author <a href="mailto:docodan@mvcsoft.com">Daniel OConnor</a>
- * @version $Revision: 1.48 $
+ * @author <a href="mailto:Christoph.Jung@infor.de">Christoph G. Jung</a>
+ * @version $Revision: 1.49 $
*/
public class StatelessSessionContainer
- extends Container
+ extends SessionContainer
implements EJBProxyFactoryContainer, InstancePoolContainer
{
- /**
- * These are the mappings between the home interface methods and the
- * container methods.
- */
- protected Map homeMapping;
-
- /**
- * These are the mappings between the remote interface methods and the
- * bean methods.
- */
- protected Map beanMapping;
-
- /** This is the instancepool that is to be used */
- protected InstancePool instancePool;
-
- /**
- * This is the first interceptor in the chain. The last interceptor must
- * be provided by the container itself
- */
- protected Interceptor interceptor;
-
- public LocalProxyFactory getLocalProxyFactory()
- {
- return localProxyFactory;
- }
-
- public void setInstancePool(InstancePool ip)
- {
- if (ip == null)
- throw new IllegalArgumentException("Null pool");
-
- this.instancePool = ip;
- ip.setContainer(this);
- }
-
- public InstancePool getInstancePool()
- {
- return instancePool;
- }
-
- public void addInterceptor(Interceptor in)
- {
- if (interceptor == null)
- {
- interceptor = in;
- } else
- {
- Interceptor current = interceptor;
- while ( current.getNext() != null)
- {
- current = current.getNext();
- }
-
- current.setNext(in);
- }
- }
-
- public Interceptor getInterceptor()
- {
- return interceptor;
- }
-
- public Class getHomeClass()
- {
- return homeInterface;
- }
-
- public Class getRemoteClass()
- {
- return remoteInterface;
- }
-
- // Container implementation --------------------------------------
-
- protected void createService() throws Exception
- {
- // Associate thread with classloader
- ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
- Thread.currentThread().setContextClassLoader(getClassLoader());
-
- try
- {
- // 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.createService();
-
- // Make some additional validity checks with regards to the container \
configuration
- checkCoherency ();
-
- // Map the bean methods
- setupBeanMapping();
-
- // Map the home methods
- setupHomeMapping();
-
- // Map the interfaces to Long
- setupMarshalledInvocationMapping();
-
- // Initialize pool
- instancePool.create();
- // Try to register the instance pool as an MBean
- try
- {
- ObjectName containerName = super.getJmxName();
- Hashtable props = containerName.getKeyPropertyList();
- props.put("plugin", "pool");
- ObjectName poolName = new ObjectName(containerName.getDomain(), \
props);
- server.registerMBean(instancePool, poolName);
- }
- catch(Throwable t)
- {
- log.debug("Failed to register pool as mbean", t);
- }
-
- // Init container invoker
- for (Iterator it = proxyFactories.keySet().iterator(); it.hasNext(); )
- {
- String invokerBinding = (String)it.next();
- EJBProxyFactory ci = \
(EJBProxyFactory)proxyFactories.get(invokerBinding);
- ci.create();
- }
-
-
-
- // Initialize the interceptor by calling the chain
- Interceptor in = interceptor;
- while (in != null)
- {
- in.setContainer(this);
- in.create();
- in = in.getNext();
- }
- }
- finally
- {
- // Reset classloader
- Thread.currentThread().setContextClassLoader(oldCl);
- }
- }
-
- protected void startService() throws Exception
- {
- // Associate thread with classloader
- ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
- Thread.currentThread().setContextClassLoader(getClassLoader());
-
- try
- {
- // Call default start
- super.startService();
-
- // Start container invoker
- for (Iterator it = proxyFactories.keySet().iterator(); it.hasNext(); )
- {
- String invokerBinding = (String)it.next();
- EJBProxyFactory ci = \
(EJBProxyFactory)proxyFactories.get(invokerBinding);
- ci.start();
- }
-
- // Start the instance pool
- instancePool.start();
-
- // Start all interceptors in the chain
- Interceptor in = interceptor;
- while (in != null)
- {
- in.start();
- in = in.getNext();
- }
- }
- finally
- {
- // Reset classloader
- Thread.currentThread().setContextClassLoader(oldCl);
- }
- }
-
- protected void stopService() throws Exception
- {
- // Associate thread with classloader
- ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
- Thread.currentThread().setContextClassLoader(getClassLoader());
-
- try
- {
- // Call default stop
- super.stopService();
-
- // Stop container invoker
- for (Iterator it = proxyFactories.keySet().iterator(); it.hasNext(); )
- {
- String invokerBinding = (String)it.next();
- EJBProxyFactory ci = \
(EJBProxyFactory)proxyFactories.get(invokerBinding);
- ci.stop();
- }
-
- // Stop the instance pool
- instancePool.stop();
-
- // Stop all interceptors in the chain
- Interceptor in = interceptor;
- while (in != null)
- {
- in.stop();
- in = in.getNext();
- }
- }
- finally
- {
- // Reset classloader
- Thread.currentThread().setContextClassLoader(oldCl);
- }
- }
-
- protected void destroyService() throws Exception
- {
- // Associate thread with classloader
- ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
- Thread.currentThread().setContextClassLoader(getClassLoader());
-
- try
- {
- // Destroy container invoker
- for (Iterator it = proxyFactories.keySet().iterator(); it.hasNext(); )
- {
- String invokerBinding = (String)it.next();
- EJBProxyFactory ci = \
(EJBProxyFactory)proxyFactories.get(invokerBinding);
- ci.destroy();
- ci.setContainer(null);
- }
-
- // Destroy the pool
- instancePool.destroy();
- instancePool.setContainer(null);
- try
- {
- ObjectName containerName = super.getJmxName();
- Hashtable props = containerName.getKeyPropertyList();
- props.put("plugin", "pool");
- ObjectName poolName = new ObjectName(containerName.getDomain(), \
props);
- server.unregisterMBean(poolName);
- }
- catch(Throwable ignore)
- {
- }
-
- // Destroy all the interceptors in the chain
- Interceptor in = interceptor;
- while (in != null)
- {
- in.destroy();
- in.setContainer(null);
- in = in.getNext();
- }
-
- MarshalledInvocation.removeHashes(homeInterface);
- MarshalledInvocation.removeHashes(remoteInterface);
-
- // Call default destroy
- super.destroyService();
- }
- finally
- {
- // Reset classloader
- Thread.currentThread().setContextClassLoader(oldCl);
- }
- }
-
- public Object internalInvokeHome(Invocation mi) throws Exception
- {
- return getInterceptor().invokeHome(mi);
- }
-
- /**
- * This method does invocation interpositioning of tx and security,
- * retrieves the instance from an object table, and invokes the method
- * on the particular instance
- */
- public Object internalInvoke(Invocation mi)
- throws Exception
- {
- // Invoke through interceptors
- return getInterceptor().invoke(mi);
- }
-
// EJBObject implementation --------------------------------------
/**
@@ -342,54 +47,6 @@
//TODO
}
- /**
- * @return Always null
- */
- public Handle getHandle(Invocation mi)
- throws RemoteException
- {
- // TODO
- return null;
- }
-
- /**
- * @return Always null
- */
- public Object getPrimaryKey(Invocation mi)
- throws RemoteException
- {
- // TODO
- return null;
- }
-
- public EJBHome getEJBHome(Invocation mi)
- throws RemoteException
- {
- EJBProxyFactory ci = getProxyFactory();
- if (ci == null)
- {
- String msg = "No ProxyFactory, check for ProxyFactoryFinderInterceptor";
- throw new IllegalStateException(msg);
- }
- return (EJBHome) ci.getEJBHome();
- }
-
- /**
- * @return Always false
- */
- public boolean isIdentical(Invocation mi)
- throws RemoteException
- {
- return false; // TODO
- }
-
- // EJBLocalObject implementation
-
- public EJBLocalHome getEJBLocalHome(Invocation mi)
- {
- return localProxyFactory.getEJBLocalHome();
- }
-
// EJBLocalHome implementation
public EJBLocalObject createLocalHome()
@@ -503,118 +160,11 @@
homeMapping = map;
}
- private void setUpBeanMappingImpl( Map map, Method[] m, String declaringClass )
- throws NoSuchMethodException
- {
- boolean debug = log.isDebugEnabled();
-
- for (int i = 0; i < m.length; i++)
- {
- if (!m[i].getDeclaringClass().getName().equals(declaringClass))
- {
- // Implemented by bean
- try {
- map.put(m[i], beanClass.getMethod(m[i].getName(), \
m[i].getParameterTypes()));
- }
- catch (NoSuchMethodException ex)
- {
- throw new org.jboss.util.NoSuchMethodException("Not found in bean \
class: ", m[i]);
- }
-
- if (debug)
- log.debug("Mapped "+m[i].getName()+" "+m[i].hashCode()+"to \
"+map.get(m[i]));
- }
- else
- {
- try
- {
- // Implemented by container
- if (debug)
- log.debug("Mapped Container method "+m[i].getName() +" HASH \
"+m[i].hashCode());
- map.put(m[i], getClass().getMethod(m[i].getName(), new Class[] { \
Invocation.class }));
- }
- catch (NoSuchMethodException e)
- {
- log.error(m[i].getName() + " in bean has not been mapped", e);
- }
- }
- }
- }
-
- protected void setupBeanMapping()
- throws NoSuchMethodException
- {
- Map map = new HashMap();
-
- if (remoteInterface != null)
- {
- Method[] m = remoteInterface.getMethods();
- setUpBeanMappingImpl( map, m, "javax.ejb.EJBObject" );
- }
- if (localInterface != null)
- {
- Method[] m = localInterface.getMethods();
- setUpBeanMappingImpl( map, m, "javax.ejb.EJBLocalObject" );
- }
-
- beanMapping = map;
- }
-
- protected void setupMarshalledInvocationMapping() throws Exception
- {
- // Create method mappings for container invoker
- if (homeInterface != null)
- {
- Method [] m = homeInterface.getMethods();
- for (int i = 0 ; i<m.length ; i++)
- {
- marshalledInvocationMapping.put( new \
Long(MarshalledInvocation.calculateHash(m[i])), m[i]);
- }
- }
-
- if (remoteInterface != null)
- {
- Method [] m = remoteInterface.getMethods();
- for (int j = 0 ; j<m.length ; j++)
- {
- marshalledInvocationMapping.put( new \
Long(MarshalledInvocation.calculateHash(m[j])), m[j]);
- }
- }
-
- // Get the getEJBObjectMethod
- Method getEJBObjectMethod = \
Class.forName("javax.ejb.Handle").getMethod("getEJBObject", new \
Class[0]);
-
- // Hash it
- marshalledInvocationMapping.put(new \
Long(MarshalledInvocation.calculateHash(getEJBObjectMethod)),getEJBObjectMethod);
- }
-
Interceptor createContainerInterceptor()
{
return new ContainerInterceptor();
}
- protected void checkCoherency () throws Exception
- {
- // Check clustering cohrency wrt metadata
- //
- if (metaData.isClustered())
- {
- boolean clusteredProxyFactoryFound = false;
- for (Iterator it = proxyFactories.keySet().iterator(); it.hasNext(); )
- {
- String invokerBinding = (String)it.next();
- EJBProxyFactory ci = \
(EJBProxyFactory)proxyFactories.get(invokerBinding);
- if (ci instanceof org.jboss.proxy.ejb.ClusterProxyFactory)
- clusteredProxyFactoryFound = true;
- }
-
- if (!clusteredProxyFactoryFound)
- {
- log.warn("*** EJB '" + this.metaData.getEjbName() + "' deployed as \
CLUSTERED but not a single clustered-invoker is bound to container \
***");
- }
- }
- }
-
/**
* This is the last step before invocation - all interceptors are done
*/
@@ -624,7 +174,7 @@
public Object invokeHome(Invocation mi) throws Exception
{
Method miMethod = mi.getMethod();
- Method m = (Method) homeMapping.get(miMethod);
+ Method m = (Method) getHomeMapping().get(miMethod);
if( m == null )
{
String msg = "Invalid invocation, check your deployment packaging"
@@ -654,7 +204,7 @@
// Get method and instance to invoke upon
Method miMethod = mi.getMethod();
- Method m = (Method) beanMapping.get(miMethod);
+ Method m = (Method) getBeanMapping().get(miMethod);
if( m == null )
{
String msg = "Invalid invocation, check your deployment packaging"
1.1 jboss/src/main/org/jboss/ejb/SessionContainer.java
Index: SessionContainer.java
===================================================================
/*
* JBoss, the OpenSource J2EE webOS
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package org.jboss.ejb;
import java.lang.reflect.Method;
import java.rmi.RemoteException;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;
import javax.ejb.EJBHome;
import javax.ejb.EJBLocalHome;
import javax.ejb.Handle;
import javax.management.ObjectName;
import org.jboss.invocation.Invocation;
import org.jboss.invocation.MarshalledInvocation;
import org.jboss.metadata.SessionMetaData;
/**
* <p>
* Container dedicated to session beans. Contains factored out
* redundancies between stateless and stateful treatments, because
* (extending the spec) we would like to also support stateful
* web services.
* </p>
* @author <a href="mailto:Christoph.Jung@infor.de">Christoph G. Jung</a>
* @version $Revision: 1.1 $
* @since 30.10.2003
*/
public abstract class SessionContainer extends Container {
/**
* These are the mappings between the home interface methods and the
* container methods.
*/
protected Map homeMapping;
/**
* These are the mappings between the remote interface methods and the
* bean methods.
*/
protected Map beanMapping;
/**
* This is the first interceptor in the chain. The last interceptor must
* be provided by the container itself
*/
protected Interceptor interceptor;
/** this is the service endpoint class */
protected Class serviceEndpoint;
/** This is the instancepool that is to be used */
protected InstancePool instancePool;
/** set the instance pool */
public void setInstancePool(InstancePool ip) {
if (ip == null)
throw new IllegalArgumentException("Null pool");
this.instancePool = ip;
ip.setContainer(this);
}
/** return instance pool */
public InstancePool getInstancePool() {
return instancePool;
}
/** return local proxy factory */
public LocalProxyFactory getLocalProxyFactory() {
return localProxyFactory;
}
/** add an additional interceptor to the chain */
public void addInterceptor(Interceptor in) {
if (interceptor == null) {
interceptor = in;
} else {
Interceptor current = interceptor;
while (current.getNext() != null) {
current = current.getNext();
}
current.setNext(in);
}
}
/** return first interceptor */
public Interceptor getInterceptor() {
return interceptor;
}
/** return home class */
public Class getHomeClass() {
return homeInterface;
}
/** return remote class */
public Class getRemoteClass() {
return remoteInterface;
}
/** return service endpoint */
public Class getServiceEndpoint() {
return serviceEndpoint;
}
// Container stuff
protected void createService() throws Exception {
// Associate thread with classloader
ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(getClassLoader());
try {
// Acquire classes from CL
if (metaData.getHome() != null)
homeInterface = classLoader.loadClass(metaData.getHome());
if (metaData.getRemote() != null)
remoteInterface = classLoader.loadClass(metaData.getRemote());
if (((SessionMetaData) metaData).getServiceEndpoint() != null) {
serviceEndpoint =
classLoader.loadClass(
((SessionMetaData) metaData).getServiceEndpoint());
}
// Call default init
super.createService();
// Make some additional validity checks with regards to the container \
configuration checkCoherency();
// Map the bean methods
setupBeanMapping();
// Map the home methods
setupHomeMapping();
// Map the interfaces to Long
setupMarshalledInvocationMapping();
createInvokers();
createInstanceCache();
createInstancePool();
createPersistenceManager();
createInterceptors();
} finally {
// Reset classloader
Thread.currentThread().setContextClassLoader(oldCl);
}
}
/**
* how home methods are treated by container
*/
protected abstract void setupHomeMapping() throws Exception;
/** loop through methods and setup mapping */
protected void setUpBeanMappingImpl(
Map map,
Method[] m,
String declaringClass)
throws NoSuchMethodException {
boolean debug = log.isDebugEnabled();
for (int i = 0; i < m.length; i++) {
if (!m[i].getDeclaringClass().getName().equals(declaringClass)) {
// Implemented by bean
try {
map.put(
m[i],
beanClass.getMethod(
m[i].getName(),
m[i].getParameterTypes()));
} catch (NoSuchMethodException ex) {
throw new org.jboss.util.NoSuchMethodException(
"Not found in bean class: ",
m[i]);
}
if (debug)
log.debug(
"Mapped "
+ m[i].getName()
+ " "
+ m[i].hashCode()
+ "to "
+ map.get(m[i]));
} else {
try {
// Implemented by container
if (debug)
log.debug(
"Mapped Container method "
+ m[i].getName()
+ " HASH "
+ m[i].hashCode());
map.put(
m[i],
getClass().getMethod(
m[i].getName(),
new Class[] { Invocation.class }));
} catch (NoSuchMethodException e) {
log.error(m[i].getName() + " in bean has not been mapped", e);
}
}
}
}
/** build bean mappings for application logic */
protected void setupBeanMapping() throws NoSuchMethodException {
Map map = new HashMap();
if (remoteInterface != null) {
Method[] m = remoteInterface.getMethods();
setUpBeanMappingImpl(map, m, "javax.ejb.EJBObject");
}
if (localInterface != null) {
Method[] m = localInterface.getMethods();
setUpBeanMappingImpl(map, m, "javax.ejb.EJBLocalObject");
}
if (serviceEndpoint != null) {
Method[] m = serviceEndpoint.getMethods();
setUpBeanMappingImpl(map, m, "java.rmi.Remote");
}
beanMapping = map;
}
protected void setupMarshalledInvocationMapping() throws Exception {
// Create method mappings for container invoker
if (homeInterface != null) {
Method[] m = homeInterface.getMethods();
for (int i = 0; i < m.length; i++) {
marshalledInvocationMapping.put(
new Long(MarshalledInvocation.calculateHash(m[i])),
m[i]);
}
}
if (remoteInterface != null) {
Method[] m = remoteInterface.getMethods();
for (int j = 0; j < m.length; j++) {
marshalledInvocationMapping.put(
new Long(MarshalledInvocation.calculateHash(m[j])),
m[j]);
}
}
// Get the getEJBObjectMethod
Method getEJBObjectMethod =
Class.forName("javax.ejb.Handle").getMethod(
"getEJBObject",
new Class[0]);
// Hash it
marshalledInvocationMapping.put(
new Long(MarshalledInvocation.calculateHash(getEJBObjectMethod)),
getEJBObjectMethod);
}
protected void checkCoherency() throws Exception {
// Check clustering cohrency wrt metadata
//
if (metaData.isClustered()) {
boolean clusteredProxyFactoryFound = false;
for (Iterator it = proxyFactories.keySet().iterator();
it.hasNext();
) {
String invokerBinding = (String) it.next();
EJBProxyFactory ci =
(EJBProxyFactory) proxyFactories.get(invokerBinding);
if (ci instanceof org.jboss.proxy.ejb.ClusterProxyFactory)
clusteredProxyFactoryFound = true;
}
if (!clusteredProxyFactoryFound) {
log.warn(
"*** EJB '"
+ this.metaData.getEjbName()
+ "' deployed as CLUSTERED but not a single clustered-invoker is \
bound to container ***"); }
}
}
/** creates a new instance pool */
protected void createInstancePool() throws Exception {
// Initialize pool
instancePool.create();
// Try to register the instance pool as an MBean
try {
ObjectName containerName = super.getJmxName();
Hashtable props = containerName.getKeyPropertyList();
props.put("plugin", "pool");
ObjectName poolName = new ObjectName(containerName.getDomain(), props);
server.registerMBean(instancePool, poolName);
} catch (Throwable t) {
log.debug("Failed to register pool as mbean", t);
}
}
/**
* no instance cache per default
*/
protected void createInstanceCache() throws Exception {
}
/** creates the invokers */
protected void createInvokers() throws Exception {
// Init container invoker
for (Iterator it = proxyFactories.keySet().iterator(); it.hasNext();) {
String invokerBinding = (String) it.next();
EJBProxyFactory ci =
(EJBProxyFactory) proxyFactories.get(invokerBinding);
ci.create();
}
}
/** Initialize the interceptors by calling the chain */
protected void createInterceptors() throws Exception {
Interceptor in = interceptor;
while (in != null) {
in.setContainer(this);
in.create();
in = in.getNext();
}
}
/**
* no persistence manager per default
*/
protected void createPersistenceManager() throws Exception {
}
protected void startService() throws Exception {
// Associate thread with classloader
ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(getClassLoader());
try {
// Call default start
super.startService();
startInvokers();
startInstanceCache();
startInstancePool();
startPersistenceManager();
startInterceptors();
} finally {
// Reset classloader
Thread.currentThread().setContextClassLoader(oldCl);
}
}
/**
* no persistence manager per default
*/
protected void startPersistenceManager() throws Exception {
}
/**
* no instance cache per default
*/
protected void startInstanceCache() throws Exception {
}
/** Start container invokers */
protected void startInvokers() throws Exception {
for (Iterator it = proxyFactories.keySet().iterator(); it.hasNext();) {
String invokerBinding = (String) it.next();
EJBProxyFactory ci =
(EJBProxyFactory) proxyFactories.get(invokerBinding);
ci.start();
}
}
/** Start pool */
protected void startInstancePool() throws Exception {
instancePool.start();
}
/** Start all interceptors in the chain **/
protected void startInterceptors() throws Exception {
Interceptor in = interceptor;
while (in != null) {
in.start();
in = in.getNext();
}
}
protected void stopService() throws Exception {
// Associate thread with classloader
ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(getClassLoader());
try {
// Call default stop
super.stopService();
stopInvokers();
stopInstanceCache();
stopInstancePool();
stopPersistenceManager();
stopInterceptors();
} finally {
// Reset classloader
Thread.currentThread().setContextClassLoader(oldCl);
}
}
/** Stop all interceptors in the chain */
protected void stopInterceptors() {
Interceptor in = interceptor;
while (in != null) {
in.stop();
in = in.getNext();
}
}
/** no persistence */
protected void stopPersistenceManager() {
}
/** Stop pool */
protected void stopInstancePool() {
instancePool.stop();
}
/** no instance cache */
protected void stopInstanceCache() {
}
/** Stop container invoker */
protected void stopInvokers() {
for (Iterator it = proxyFactories.keySet().iterator(); it.hasNext();) {
String invokerBinding = (String) it.next();
EJBProxyFactory ci =
(EJBProxyFactory) proxyFactories.get(invokerBinding);
ci.stop();
}
}
protected void destroyService() throws Exception {
// Associate thread with classloader
ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(getClassLoader());
try {
destroyInvokers();
destroyInstanceCache();
destroyInstancePool();
destroyPersistenceManager();
destroyInterceptors();
destroyMarshalledInvocationMapping();
// Call default destroy
super.destroyService();
} finally {
// Reset classloader
Thread.currentThread().setContextClassLoader(oldCl);
}
}
protected void destroyMarshalledInvocationMapping() {
MarshalledInvocation.removeHashes(homeInterface);
MarshalledInvocation.removeHashes(remoteInterface);
}
protected void destroyInterceptors() {
// Destroy all the interceptors in the chain
Interceptor in = interceptor;
while (in != null) {
in.destroy();
in.setContainer(null);
in = in.getNext();
}
}
protected void destroyPersistenceManager() {
}
protected void destroyInstancePool() {
// Destroy pool
instancePool.destroy();
instancePool.setContainer(null);
try {
ObjectName containerName = super.getJmxName();
Hashtable props = containerName.getKeyPropertyList();
props.put("plugin", "pool");
ObjectName poolName = new ObjectName(containerName.getDomain(), props);
server.unregisterMBean(poolName);
} catch (Throwable ignore) {
}
}
protected void destroyInstanceCache() {
}
protected void destroyInvokers() {
// Destroy container invoker
for (Iterator it = proxyFactories.keySet().iterator(); it.hasNext();) {
String invokerBinding = (String) it.next();
EJBProxyFactory ci =
(EJBProxyFactory) proxyFactories.get(invokerBinding);
ci.destroy();
ci.setContainer(null);
}
}
public Object internalInvokeHome(Invocation mi) throws Exception {
return getInterceptor().invokeHome(mi);
}
/**
* This method does invocation interpositioning of tx and security,
* retrieves the instance from an object table, and invokes the method
* on the particular instance
*/
public Object internalInvoke(Invocation mi) throws Exception {
// Invoke through interceptors
return getInterceptor().invoke(mi);
}
// EJBObject implementation --------------------------------------
/**
* While the following methods are implemented in the client in the case
* of JRMP we would need to implement them to fully support other transport
* protocols
*
* @return Always null
*/
public Handle getHandle(Invocation mi) throws RemoteException {
// TODO
return null;
}
/**
* @return Always null
*/
public Object getPrimaryKey(Invocation mi) throws RemoteException {
// TODO
return null;
}
public EJBHome getEJBHome(Invocation mi) throws RemoteException {
EJBProxyFactory ci = getProxyFactory();
if (ci == null) {
String msg =
"No ProxyFactory, check for ProxyFactoryFinderInterceptor";
throw new IllegalStateException(msg);
}
return (EJBHome) ci.getEJBHome();
}
/**
* @return Always false
*/
public boolean isIdentical(Invocation mi) throws RemoteException {
return false; // TODO
}
// Home interface implementation ---------------------------------
// local object interface implementation
public EJBLocalHome getEJBLocalHome(Invocation mi) {
return localProxyFactory.getEJBLocalHome();
}
/**
* needed for sub-inner-class access (old jdk compiler bug)
* @return
*/
protected Map getHomeMapping() {
return homeMapping;
}
/**
* needed for sub-inner-class access (old jdk compiler bug)
* @return
*/
protected Map getBeanMapping() {
return beanMapping;
}
}
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
jboss-cvs-commits mailing list
jboss-cvs-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jboss-cvs-commits
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic