[jboss-cvs] JBossAS SVN: r64353 - in trunk/ejb3/src/main/org/jboss/ejb3: cache and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Jul 30 13:04:11 EDT 2007
Author: wolfc
Date: 2007-07-30 13:04:11 -0400 (Mon, 30 Jul 2007)
New Revision: 64353
Modified:
trunk/ejb3/src/main/org/jboss/ejb3/AbstractPool.java
trunk/ejb3/src/main/org/jboss/ejb3/Container.java
trunk/ejb3/src/main/org/jboss/ejb3/EJBContainer.java
trunk/ejb3/src/main/org/jboss/ejb3/EJBContextFactory.java
trunk/ejb3/src/main/org/jboss/ejb3/StrictMaxPool.java
trunk/ejb3/src/main/org/jboss/ejb3/cache/NoPassivationCache.java
trunk/ejb3/src/main/org/jboss/ejb3/service/ServiceContainer.java
trunk/ejb3/src/main/org/jboss/ejb3/stateful/BaseStatefulProxyFactory.java
trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulClusterProxyFactory.java
trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulContainer.java
trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulLocalProxyFactory.java
trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulRemoteProxyFactory.java
Log:
EJBTHREE-1016: refactored creation of local sfsb
Modified: trunk/ejb3/src/main/org/jboss/ejb3/AbstractPool.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/AbstractPool.java 2007-07-30 15:38:52 UTC (rev 64352)
+++ trunk/ejb3/src/main/org/jboss/ejb3/AbstractPool.java 2007-07-30 17:04:11 UTC (rev 64353)
@@ -21,24 +21,22 @@
*/
package org.jboss.ejb3;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-
-import org.jboss.injection.Injector;
import org.jboss.annotation.ejb.cache.tree.CacheConfig;
import org.jboss.aop.Advisor;
import org.jboss.ejb3.stateful.StatefulBeanContext;
+import org.jboss.injection.Injector;
import org.jboss.logging.Logger;
-import org.jboss.util.id.GUID;
/**
- * Comment
+ * The base of all pool implementations.
*
* @author <a href="mailto:bill at jboss.org">Bill Burke</a>
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
* @version $Revision$
*/
public abstract class AbstractPool implements Pool
{
+ @SuppressWarnings("unused")
private static final Logger log = Logger.getLogger(AbstractPool.class);
protected Injector[] injectors;
@@ -58,72 +56,29 @@
public abstract void setMaxSize(int maxSize);
+ @Deprecated
protected BeanContext<?> create()
{
- BeanContext<?> ctx;
- ctx = createBeanContext();
- if (ctx instanceof StatefulBeanContext)
- {
- StatefulBeanContext sfctx = (StatefulBeanContext) ctx;
- // Tell context how to handle replication
- Advisor advisor = (Advisor) container;
- CacheConfig config = (CacheConfig) advisor.resolveAnnotation(CacheConfig.class);
- if (config != null)
- {
- sfctx.setReplicationIsPassivation(config.replicationIsPassivation());
- }
- // this is for propagated extended PC's
- ctx = sfctx = sfctx.pushContainedIn();
- }
- container.pushContext(ctx);
- try
- {
- if (injectors != null)
- {
- for (int i = 0; i < injectors.length; i++)
- {
- injectors[i].inject(ctx);
- }
- }
-
- ctx.initialiseInterceptorInstances();
-
- }
- finally
- {
- container.popContext();
- if (ctx instanceof StatefulBeanContext)
- {
- // this is for propagated extended PC's
- StatefulBeanContext sfctx = (StatefulBeanContext) ctx;
- sfctx.popContainedIn();
- }
- }
-
- //TODO This needs to be reimplemented as replacement for create() on home interface
- container.invokeInit(ctx.getInstance());
-
- container.invokePostConstruct(ctx, new Object[0]);
- return ctx;
+ return create(null, null);
}
-
+
protected BeanContext<?> create(Class[] initTypes, Object[] initValues)
{
BeanContext ctx;
ctx = createBeanContext();
- if (ctx instanceof StatefulBeanContext)
- {
- StatefulBeanContext sfctx = (StatefulBeanContext) ctx;
- // Tell context how to handle replication
- Advisor advisor = (Advisor) container;
- CacheConfig config = (CacheConfig) advisor.resolveAnnotation(CacheConfig.class);
- if (config != null)
- {
- sfctx.setReplicationIsPassivation(config.replicationIsPassivation());
- }
- // this is for propagated extended PC's
- ctx = sfctx = sfctx.pushContainedIn();
- }
+// if (ctx instanceof StatefulBeanContext)
+// {
+// StatefulBeanContext sfctx = (StatefulBeanContext) ctx;
+// // Tell context how to handle replication
+// Advisor advisor = (Advisor) container;
+// CacheConfig config = (CacheConfig) advisor.resolveAnnotation(CacheConfig.class);
+// if (config != null)
+// {
+// sfctx.setReplicationIsPassivation(config.replicationIsPassivation());
+// }
+// // this is for propagated extended PC's
+// ctx = sfctx = sfctx.pushContainedIn();
+// }
container.pushContext(ctx);
try
{
@@ -141,17 +96,19 @@
finally
{
container.popContext();
- if (ctx instanceof StatefulBeanContext)
- {
- // this is for propagated extended PC's
- StatefulBeanContext sfctx = (StatefulBeanContext) ctx;
- sfctx.popContainedIn();
- }
+// if (ctx instanceof StatefulBeanContext)
+// {
+// // this is for propagated extended PC's
+// StatefulBeanContext sfctx = (StatefulBeanContext) ctx;
+// sfctx.popContainedIn();
+// }
}
+
+ container.invokePostConstruct(ctx, initValues);
+
//TODO This needs to be reimplemented as replacement for create() on home interface
container.invokeInit(ctx.getInstance(), initTypes, initValues);
-
- container.invokePostConstruct(ctx, initValues);
+
return ctx;
}
Modified: trunk/ejb3/src/main/org/jboss/ejb3/Container.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/Container.java 2007-07-30 15:38:52 UTC (rev 64352)
+++ trunk/ejb3/src/main/org/jboss/ejb3/Container.java 2007-07-30 17:04:11 UTC (rev 64353)
@@ -73,8 +73,6 @@
void invokePrePassivate(BeanContext beanContext);
- void invokeInit(Object bean);
-
void invokeInit(Object bean, Class[] initTypes, Object[] initValues);
BeanContext<?> peekContext();
Modified: trunk/ejb3/src/main/org/jboss/ejb3/EJBContainer.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/EJBContainer.java 2007-07-30 15:38:52 UTC (rev 64352)
+++ trunk/ejb3/src/main/org/jboss/ejb3/EJBContainer.java 2007-07-30 17:04:11 UTC (rev 64353)
@@ -267,16 +267,6 @@
return JavaEEComponentHelper.createObjectName(deployment, unitName, ejbName);
}
- public EjbEncFactory getEncFactory()
- {
- return encFactory;
- }
-
- public void setEncFactory(EjbEncFactory encFactory)
- {
- this.encFactory = encFactory;
- }
-
public void pushContext(BeanContext<?> beanContext)
{
currentBean.push(beanContext);
@@ -288,7 +278,7 @@
* onto the stack
*
*/
- public void pushEnc()
+ protected void pushEnc()
{
encFactory.pushEnc(this);
}
@@ -310,7 +300,7 @@
* is used to pop the EJB's ENC from the stock
*
*/
- public void popEnc()
+ protected void popEnc()
{
encFactory.popEnc(this);
}
@@ -789,15 +779,10 @@
throw new RuntimeException("PrePassivate not implemented for container");
}
- public void invokeInit(Object bean)
- {
-
- }
-
public void invokeInit(Object bean, Class[] initParameterTypes,
Object[] initParameterValues)
{
-
+ // do nothing, only useful on a stateful session bean
}
public static final String MANAGED_ENTITY_MANAGER_FACTORY = "ManagedEntityManagerFactory";
Modified: trunk/ejb3/src/main/org/jboss/ejb3/EJBContextFactory.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/EJBContextFactory.java 2007-07-30 15:38:52 UTC (rev 64352)
+++ trunk/ejb3/src/main/org/jboss/ejb3/EJBContextFactory.java 2007-07-30 17:04:11 UTC (rev 64353)
@@ -23,6 +23,7 @@
import java.util.Hashtable;
+import javax.ejb.EJBContext;
import javax.naming.Context;
import javax.naming.Name;
import javax.naming.Reference;
Modified: trunk/ejb3/src/main/org/jboss/ejb3/StrictMaxPool.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/StrictMaxPool.java 2007-07-30 15:38:52 UTC (rev 64352)
+++ trunk/ejb3/src/main/org/jboss/ejb3/StrictMaxPool.java 2007-07-30 17:04:11 UTC (rev 64353)
@@ -84,44 +84,17 @@
this.strictMaxSize = new FIFOSemaphore(maxSize);
}
+ public BeanContext<?> get()
+ {
+ return get(null, null);
+ }
+
/**
* Get an instance without identity.
* Can be used by finders,create-methods, and activation
*
* @return Context /w instance
*/
- public BeanContext<?> get()
- {
- boolean trace = log.isTraceEnabled();
- if (trace)
- log.trace("Get instance " + this + "#" + pool.size() + "#" + container.getBeanClass());
-
- // Block until an instance is available
- try
- {
- boolean acquired = strictMaxSize.attempt(strictTimeout);
- if (trace)
- log.trace("Acquired(" + acquired + ") strictMaxSize semaphore, remaining=" + strictMaxSize.permits());
- if (acquired == false)
- throw new EJBException("Failed to acquire the pool semaphore, strictTimeout=" + strictTimeout);
- }
- catch (InterruptedException e)
- {
- throw new EJBException("Pool strictMaxSize semaphore was interrupted");
- }
-
- synchronized (pool)
- {
- if (!pool.isEmpty())
- {
- return pool.removeFirst();
- }
- }
-
- // Pool is empty, create an instance
- return create();
- }
-
public BeanContext<?> get(Class[] initTypes, Object[] initValues)
{
boolean trace = log.isTraceEnabled();
Modified: trunk/ejb3/src/main/org/jboss/ejb3/cache/NoPassivationCache.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/cache/NoPassivationCache.java 2007-07-30 15:38:52 UTC (rev 64352)
+++ trunk/ejb3/src/main/org/jboss/ejb3/cache/NoPassivationCache.java 2007-07-30 17:04:11 UTC (rev 64353)
@@ -38,12 +38,12 @@
public class NoPassivationCache implements StatefulCache
{
private Pool pool;
- private HashMap cacheMap;
+ private HashMap<Object, StatefulBeanContext> cacheMap;
public void initialize(Container container) throws Exception
{
this.pool = container.getPool();
- cacheMap = new HashMap();
+ cacheMap = new HashMap<Object, StatefulBeanContext>();
}
public NoPassivationCache()
@@ -64,28 +64,9 @@
public StatefulBeanContext create()
{
- StatefulBeanContext ctx = null;
- try
- {
- ctx = (StatefulBeanContext) pool.get();
- synchronized (cacheMap)
- {
- cacheMap.put(ctx.getId(), ctx);
- }
- }
- catch (EJBException e)
- {
- e.printStackTrace();
- throw e;
- }
- catch (Exception e)
- {
- e.printStackTrace();
- throw new EJBException(e);
- }
- return ctx;
+ return create(null, null);
}
-
+
public StatefulBeanContext create(Class[] initTypes, Object[] initValues)
{
StatefulBeanContext ctx = null;
Modified: trunk/ejb3/src/main/org/jboss/ejb3/service/ServiceContainer.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/service/ServiceContainer.java 2007-07-30 15:38:52 UTC (rev 64352)
+++ trunk/ejb3/src/main/org/jboss/ejb3/service/ServiceContainer.java 2007-07-30 17:04:11 UTC (rev 64353)
@@ -303,11 +303,6 @@
//Ignore
}
- public void invokeInit(Object bean)
- {
- //Ignore
- }
-
/**
* Performs a synchronous local invocation
*/
Modified: trunk/ejb3/src/main/org/jboss/ejb3/stateful/BaseStatefulProxyFactory.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/stateful/BaseStatefulProxyFactory.java 2007-07-30 15:38:52 UTC (rev 64352)
+++ trunk/ejb3/src/main/org/jboss/ejb3/stateful/BaseStatefulProxyFactory.java 2007-07-30 17:04:11 UTC (rev 64353)
@@ -23,6 +23,8 @@
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+
import javax.naming.Context;
import javax.naming.Name;
import javax.naming.NamingException;
@@ -47,7 +49,7 @@
private static final Logger log = Logger.getLogger(BaseStatefulProxyFactory.class);
// protected Class proxyClass;
- protected Constructor proxyConstructor;
+ private Constructor proxyConstructor;
// protected Context proxyFactoryContext;
protected String jndiName;
@@ -62,6 +64,29 @@
this.jndiName = jndiName;
}
+ protected Object constructProxy(InvocationHandler handler)
+ {
+ try
+ {
+ return proxyConstructor.newInstance(handler);
+ }
+ catch (InstantiationException e)
+ {
+ throw new RuntimeException(e);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new RuntimeException(e);
+ }
+ catch (InvocationTargetException e)
+ {
+ Throwable t = e.getTargetException();
+ if(t instanceof RuntimeException)
+ throw (RuntimeException) t;
+ throw new RuntimeException(t);
+ }
+ }
+
public void init() throws Exception
{
Class[] interfaces = getInterfaces();
Modified: trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulClusterProxyFactory.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulClusterProxyFactory.java 2007-07-30 15:38:52 UTC (rev 64352)
+++ trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulClusterProxyFactory.java 2007-07-30 17:04:11 UTC (rev 64353)
@@ -138,37 +138,16 @@
public Object createProxy()
{
- try
+ Object containerId = container.getObjectName().getCanonicalName();
+ String stackName = "ClusteredStatefulSessionClientInterceptors";
+ if (binding.interceptorStack() != null && !binding.interceptorStack().equals(""))
{
- Object containerId = container.getObjectName().getCanonicalName();
- String stackName = "ClusteredStatefulSessionClientInterceptors";
- if (binding.interceptorStack() != null && !binding.interceptorStack().equals(""))
- {
- stackName = binding.interceptorStack();
- }
- AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
- String partitionName = ((StatefulContainer) container).getPartitionName();
- Object[] args = {new StatefulClusteredProxy(containerId, stack.createInterceptors((Advisor) container, null),
- wrapper, lbPolicy, partitionName)};
-
- return proxyConstructor.newInstance(args);
+ stackName = binding.interceptorStack();
}
- catch (InstantiationException e)
- {
- throw new RuntimeException(e);
- }
- catch (IllegalAccessException e)
- {
- throw new RuntimeException(e);
- }
- catch (IllegalArgumentException e)
- {
- throw new RuntimeException(e);
- }
- catch (InvocationTargetException e)
- {
- throw new RuntimeException(e.getTargetException());
- }
+ AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
+ String partitionName = ((StatefulContainer) container).getPartitionName();
+ return constructProxy(new StatefulClusteredProxy(containerId, stack.createInterceptors((Advisor) container, null),
+ wrapper, lbPolicy, partitionName));
}
public Object createProxy(Object id)
Modified: trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulContainer.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulContainer.java 2007-07-30 15:38:52 UTC (rev 64352)
+++ trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulContainer.java 2007-07-30 17:04:11 UTC (rev 64353)
@@ -251,27 +251,11 @@
}
}
- /**
- * Create a stateful bean and return its oid.
- *
- * @return
- */
protected Object createSession()
{
- ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
- pushEnc();
- try
- {
- Thread.currentThread().setContextClassLoader(classloader);
- return getCache().create().getId();
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(oldLoader);
- popEnc();
- }
+ return createSession(null, null);
}
-
+
/**
* Create a stateful bean and return its oid.
*
@@ -441,21 +425,34 @@
PrePassivate.class};
}
- public void invokeInit(Object bean)
+ public void invokeInit(Object bean, Class[] initParameterTypes,
+ Object[] initParameterValues)
{
+ int numParameters = 0;
+ if(initParameterTypes != null)
+ numParameters = initParameterTypes.length;
try
{
- Method[] methods = bean.getClass().getDeclaredMethods();
-
- for (int i = 0; i < methods.length; i++)
+ for(Method method : bean.getClass().getDeclaredMethods())
{
- if (methods[i].getParameterTypes().length == 0)
+ if(numParameters != method.getParameterTypes().length)
+ continue;
+
+ if ((method.getAnnotation(Init.class) != null)
+ || (resolveAnnotation(method, Init.class) != null))
{
- if ((methods[i].getAnnotation(Init.class) != null)
- || (resolveAnnotation(methods[i], Init.class) != null))
+ if(initParameterTypes != null)
{
- methods[i].invoke(bean, new Object[0]);
+ Object[] parameters = getInitParameters(method,
+ initParameterTypes, initParameterValues);
+
+ if (parameters != null)
+ method.invoke(bean, parameters);
}
+ else
+ {
+ method.invoke(bean);
+ }
}
}
}
@@ -465,32 +462,6 @@
}
}
- public void invokeInit(Object bean, Class[] initParameterTypes,
- Object[] initParameterValues)
- {
- try
- {
- Method[] methods = bean.getClass().getDeclaredMethods();
-
- for (int i = 0; i < methods.length; i++)
- {
- if ((methods[i].getAnnotation(Init.class) != null)
- || (resolveAnnotation(methods[i], Init.class) != null))
- {
- Object[] parameters = getInitParameters(methods[i],
- initParameterTypes, initParameterValues);
-
- if (parameters != null)
- methods[i].invoke(bean, parameters);
- }
- }
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- }
-
protected Object[] getInitParameters(Method method,
Class[] initParameterTypes, Object[] initParameterValues)
{
Modified: trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulLocalProxyFactory.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulLocalProxyFactory.java 2007-07-30 15:38:52 UTC (rev 64352)
+++ trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulLocalProxyFactory.java 2007-07-30 17:04:11 UTC (rev 64353)
@@ -21,9 +21,9 @@
*/
package org.jboss.ejb3.stateful;
-import java.lang.reflect.InvocationTargetException;
import javax.ejb.LocalHome;
import javax.naming.NamingException;
+
import org.jboss.annotation.ejb.LocalBinding;
import org.jboss.ejb3.EJBContainer;
import org.jboss.ejb3.JBossProxy;
@@ -119,83 +119,24 @@
public Object createProxy()
{
- try
- {
- StatefulContainer sfsb = (StatefulContainer) container;
- StatefulBeanContext ctx = sfsb.getCache().create();
- ctx.setInUse(false);
- Object id = ctx.getId();
- Object[] args = {new StatefulLocalProxy(container, id)};
- return proxyConstructor.newInstance(args);
- }
- catch (InstantiationException e)
- {
- throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
- }
- catch (IllegalAccessException e)
- {
- throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
- }
- catch (IllegalArgumentException e)
- {
- throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
- }
- catch (InvocationTargetException e)
- {
- throw new RuntimeException(e.getTargetException()); //To change body of catch statement use Options | File Templates.
- }
+ StatefulContainer sfsb = (StatefulContainer) container;
+// StatefulBeanContext ctx = sfsb.getCache().create();
+// ctx.setInUse(false);
+// Object id = ctx.getId();
+ Object id = sfsb.createSession();
+ return constructProxy(new StatefulLocalProxy(container, id));
}
public Object createProxy(Object id)
{
- try
- {
- StatefulContainer sfsb = (StatefulContainer) container;
- Object[] args = {new StatefulLocalProxy(container, id)};
- return proxyConstructor.newInstance(args);
- }
- catch (InstantiationException e)
- {
- throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
- }
- catch (IllegalAccessException e)
- {
- throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
- }
- catch (IllegalArgumentException e)
- {
- throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
- }
- catch (InvocationTargetException e)
- {
- throw new RuntimeException(e.getTargetException()); //To change body of catch statement use Options | File Templates.
- }
+ return constructProxy(new StatefulLocalProxy(container, id));
}
+
public Object createProxy(Class[] initTypes, Object[] initValues)
{
- try
- {
- StatefulContainer sfsb = (StatefulContainer) container;
- Object id = sfsb.createSession(initTypes, initValues);
- Object[] args = {new StatefulLocalProxy(container, id)};
- return proxyConstructor.newInstance(args);
- }
- catch (InstantiationException e)
- {
- throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
- }
- catch (IllegalAccessException e)
- {
- throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
- }
- catch (IllegalArgumentException e)
- {
- throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
- }
- catch (InvocationTargetException e)
- {
- throw new RuntimeException(e.getTargetException()); //To change body of catch statement use Options | File Templates.
- }
+ StatefulContainer sfsb = (StatefulContainer) container;
+ Object id = sfsb.createSession(initTypes, initValues);
+ return constructProxy(new StatefulLocalProxy(container, id));
}
protected StatefulHandleImpl getHandle()
Modified: trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulRemoteProxyFactory.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulRemoteProxyFactory.java 2007-07-30 15:38:52 UTC (rev 64352)
+++ trunk/ejb3/src/main/org/jboss/ejb3/stateful/StatefulRemoteProxyFactory.java 2007-07-30 17:04:11 UTC (rev 64353)
@@ -21,11 +21,11 @@
*/
package org.jboss.ejb3.stateful;
-import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Proxy;
-import javax.naming.NamingException;
import javax.ejb.RemoteHome;
+import javax.naming.NamingException;
+
import org.jboss.annotation.ejb.RemoteBinding;
import org.jboss.aop.Advisor;
import org.jboss.aop.AspectManager;
@@ -180,39 +180,19 @@
}
public Object createProxy()
{
- try
+ Object containerId = container.getObjectName().getCanonicalName();
+ String stackName = "StatefulSessionClientInterceptors";
+ if (binding.interceptorStack() != null && !binding.interceptorStack().equals(""))
{
- Object containerId = container.getObjectName().getCanonicalName();
- String stackName = "StatefulSessionClientInterceptors";
- if (binding.interceptorStack() != null && !binding.interceptorStack().equals(""))
- {
- stackName = binding.interceptorStack();
- }
- AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
- if (stack == null) throw new RuntimeException("unable to find interceptor stack: " + stackName);
- StatefulRemoteProxy proxy = new StatefulRemoteProxy(containerId, stack.createInterceptors((Advisor) container, null), locator);
+ stackName = binding.interceptorStack();
+ }
+ AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
+ if (stack == null) throw new RuntimeException("unable to find interceptor stack: " + stackName);
+ StatefulRemoteProxy proxy = new StatefulRemoteProxy(containerId, stack.createInterceptors((Advisor) container, null), locator);
- setEjb21Objects(proxy);
- Object[] args = {proxy};
- return proxyConstructor.newInstance(args);
- }
- catch (InstantiationException e)
- {
- throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
- }
- catch (IllegalAccessException e)
- {
- throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
- }
- catch (IllegalArgumentException e)
- {
- throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
- }
- catch (InvocationTargetException e)
- {
- throw new RuntimeException(e.getTargetException()); //To change body of catch statement use Options | File Templates.
- }
+ setEjb21Objects(proxy);
+ return constructProxy(proxy);
}
protected StatefulHandleImpl getHandle()
@@ -225,36 +205,16 @@
public Object createProxy(Object id)
{
- try
+ Object containerId = container.getObjectName().getCanonicalName();
+ String stackName = "StatefulSessionClientInterceptors";
+ if (binding.interceptorStack() != null && !binding.interceptorStack().equals(""))
{
- Object containerId = container.getObjectName().getCanonicalName();
- String stackName = "StatefulSessionClientInterceptors";
- if (binding.interceptorStack() != null && !binding.interceptorStack().equals(""))
- {
- stackName = binding.interceptorStack();
- }
- AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
- StatefulRemoteProxy proxy = new StatefulRemoteProxy(containerId, stack.createInterceptors((Advisor) container, null), locator, id);
- setEjb21Objects(proxy);
- Object[] args = {proxy};
- return proxyConstructor.newInstance(args);
+ stackName = binding.interceptorStack();
}
- catch (InstantiationException e)
- {
- throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
- }
- catch (IllegalAccessException e)
- {
- throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
- }
- catch (IllegalArgumentException e)
- {
- throw new RuntimeException(e); //To change body of catch statement use Options | File Templates.
- }
- catch (InvocationTargetException e)
- {
- throw new RuntimeException(e.getTargetException()); //To change body of catch statement use Options | File Templates.
- }
+ AdviceStack stack = AspectManager.instance().getAdviceStack(stackName);
+ StatefulRemoteProxy proxy = new StatefulRemoteProxy(containerId, stack.createInterceptors((Advisor) container, null), locator, id);
+ setEjb21Objects(proxy);
+ return constructProxy(proxy);
}
/**
More information about the jboss-cvs-commits
mailing list