yeap... it's fixed. :) I've read that there are ~1M emails in backlog yet.
Btw, thanks for fixing it!
On May 16, 2014 8:29 PM, "Romain Manni-Bucau" <[email protected]> wrote:

> Hi
>
> Isnt it fixed now? Mail delay?
> Le 16 mai 2014 01:03, "Thiago Veronezi" <[email protected]> a écrit :
>
> > Hi Romain,
> >
> > This is the revision that breaks the OpenEjbContainerTest that I
> mentioned
> > earlier today. wdyt?
> >
> > []s,
> > Thiago.
> >
> >
> >
> >
> > On Sat, May 10, 2014 at 3:47 PM, <[email protected]> wrote:
> >
> > > Author: rmannibucau
> > > Date: Sat May 10 19:47:21 2014
> > > New Revision: 1593721
> > >
> > > URL: http://svn.apache.org/r1593721
> > > Log:
> > > trying to avoid to create local bean lazily which creates a bottleneck
> +
> > > thread safety in cdiplugin
> > >
> > > Modified:
> > >
> > >
> >
> tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/BeanContext.java
> > >
> > >
> >
> tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
> > >
> > >
> >
> tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiPlugin.java
> > >
> > >
> >
> tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/BaseSessionContext.java
> > >
> > >
> >
> tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbHomeProxyHandler.java
> > >
> > >
> >
> tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/EndpointFactory.java
> > >
> > > Modified:
> > >
> >
> tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/BeanContext.java
> > > URL:
> > >
> >
> http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/BeanContext.java?rev=1593721&r1=1593720&r2=1593721&view=diff
> > >
> > >
> >
> ==============================================================================
> > > ---
> > >
> >
> tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/BeanContext.java
> > > (original)
> > > +++
> > >
> >
> tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/BeanContext.java
> > > Sat May 10 19:47:21 2014
> > > @@ -1816,4 +1816,16 @@ public class BeanContext extends Deploym
> > >          private Class localInterface;
> > >          private Method createMethod;
> > >      }
> > > +
> > > +    public static final class ProxyClass {
> > > +        private final Class<?> proxy;
> > > +
> > > +        public ProxyClass(final Class<?> proxy) {
> > > +            this.proxy = proxy;
> > > +        }
> > > +
> > > +        public Class<?> getProxy() {
> > > +            return proxy;
> > > +        }
> > > +    }
> > >  }
> > >
> > > Modified:
> > >
> >
> tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
> > > URL:
> > >
> >
> http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java?rev=1593721&r1=1593720&r2=1593721&view=diff
> > >
> > >
> >
> ==============================================================================
> > > ---
> > >
> >
> tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
> > > (original)
> > > +++
> > >
> >
> tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
> > > Sat May 10 19:47:21 2014
> > > @@ -72,6 +72,7 @@ import org.apache.openejb.core.ServerFed
> > >  import
> org.apache.openejb.core.SimpleTransactionSynchronizationRegistry;
> > >  import
> > org.apache.openejb.core.TransactionSynchronizationRegistryWrapper;
> > >  import org.apache.openejb.core.WebContext;
> > > +import org.apache.openejb.core.ivm.IntraVmProxy;
> > >  import org.apache.openejb.core.ivm.naming.ContextualJndiReference;
> > >  import org.apache.openejb.core.ivm.naming.IvmContext;
> > >  import org.apache.openejb.core.ivm.naming.IvmJndiFactory;
> > > @@ -124,6 +125,7 @@ import org.apache.openejb.util.SuperProp
> > >  import org.apache.openejb.util.URLs;
> > >  import org.apache.openejb.util.classloader.ClassLoaderAwareHandler;
> > >  import org.apache.openejb.util.classloader.URLClassLoaderFirst;
> > > +import org.apache.openejb.util.proxy.LocalBeanProxyFactory;
> > >  import org.apache.openejb.util.proxy.ProxyFactory;
> > >  import org.apache.openejb.util.proxy.ProxyManager;
> > >  import org.apache.webbeans.config.WebBeansContext;
> > > @@ -147,6 +149,7 @@ import javax.enterprise.context.Dependen
> > >  import javax.enterprise.context.spi.CreationalContext;
> > >  import javax.enterprise.inject.spi.Bean;
> > >  import javax.enterprise.inject.spi.BeanManager;
> > > +import javax.jms.MessageListener;
> > >  import javax.management.InstanceNotFoundException;
> > >  import javax.management.MBeanRegistrationException;
> > >  import javax.management.MBeanServer;
> > > @@ -1062,6 +1065,27 @@ public class Assembler extends Assembler
> > >
> > >  beanContext.setMethodTransactionAttribute(entry.getKey(),
> > > TransactionType.Required);
> > >                      }
> > >                  }
> > > +
> > > +                // if local bean or mdb generate proxy class now to
> > avoid
> > > bottleneck on classloader later
> > > +                if (beanContext.isLocalbean() ||
> > >
> >
> beanContext.getBusinessLocalInterfaces().contains(MessageListener.class)) {
> > > +                    final List<Class> interfaces = new
> > > ArrayList<Class>(3);
> > > +                    interfaces.add(Serializable.class);
> > > +                    interfaces.add(IntraVmProxy.class);
> > > +                    final BeanType type =
> > beanContext.getComponentType();
> > > +                    if (BeanType.STATEFUL.equals(type) ||
> > > BeanType.MANAGED.equals(type)) {
> > > +                        interfaces.add(BeanContext.Removable.class);
> > > +                    }
> > > +
> > > +                    beanContext.set(
> > > +                            BeanContext.ProxyClass.class,
> > > +                            new BeanContext.ProxyClass(
> > > +                                LocalBeanProxyFactory.createProxy(
> > > +                                    beanContext.getBeanClass(),
> > > +                                    beanContext.getClassLoader(),
> > > +                                    interfaces.toArray(new
> > > Class<?>[interfaces.size()])
> > > +                                )
> > > +                            ));
> > > +                }
> > >              }
> > >              // process application exceptions
> > >              for (final ApplicationExceptionInfo exceptionInfo :
> > > ejbJar.applicationException) {
> > >
> > > Modified:
> > >
> >
> tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiPlugin.java
> > > URL:
> > >
> >
> http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiPlugin.java?rev=1593721&r1=1593720&r2=1593721&view=diff
> > >
> > >
> >
> ==============================================================================
> > > ---
> > >
> >
> tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiPlugin.java
> > > (original)
> > > +++
> > >
> >
> tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cdi/CdiPlugin.java
> > > Sat May 10 19:47:21 2014
> > > @@ -193,62 +193,74 @@ public class CdiPlugin extends AbstractO
> > >              return instance;
> > >          }
> > >
> > > -        final Class<? extends Annotation> scopeClass =
> > inBean.getScope();
> > > -        final CdiEjbBean<Object> cdiEjbBean = (CdiEjbBean<Object>)
> > inBean;
> > > -        final CreationalContext<Object> cc =
> (CreationalContext<Object>)
> > > creationalContext;
> > > -
> > > -        if (scopeClass == null || Dependent.class == scopeClass) { //
> no
> > > need to add any layer, null = @New
> > > -            return cdiEjbBean.createEjb(cc);
> > > -        }
> > > -
> > > -        // only stateful normally
> > > -        final InstanceBean<Object> bean = new
> > > InstanceBean<Object>(cdiEjbBean);
> > > -        if
> > > (webBeansContext.getBeanManagerImpl().isNormalScope(scopeClass)) {
> > > -            final BeanContext beanContext =
> cdiEjbBean.getBeanContext();
> > > -            final Provider provider =
> > >
> >
> webBeansContext.getNormalScopeProxyFactory().getInstanceProvider(beanContext.getClassLoader(),
> > > cdiEjbBean);
> > > -
> > > -            if (!beanContext.isLocalbean()) {
> > > -                final List<Class> interfaces = new ArrayList<Class>();
> > > -                final InterfaceType type =
> > > beanContext.getInterfaceType(interfce);
> > > -                if (type != null) {
> > > -
>  interfaces.addAll(beanContext.getInterfaces(type));
> > > -                } else { // can happen when looked up from impl
> instead
> > > of API in OWB -> default to business local
> > > -
> > >
> >
>  interfaces.addAll(beanContext.getInterfaces(InterfaceType.BUSINESS_LOCAL));
> > > -                }
> > > -                interfaces.add(Serializable.class);
> > > -                interfaces.add(IntraVmProxy.class);
> > > -                if
> > > (BeanType.STATEFUL.equals(beanContext.getComponentType()) ||
> > > BeanType.MANAGED.equals(beanContext.getComponentType())) {
> > > -                    interfaces.add(BeanContext.Removable.class);
> > > -                }
> > > +        synchronized (inBean) { // singleton for the app so safe to
> sync
> > > on it
> > > +            instance = cacheProxies.get(inBean);
> > > +            if (instance != null) {
> > > +                return instance;
> > > +            }
> > > +
> > > +            final Class<? extends Annotation> scopeClass =
> > > inBean.getScope();
> > > +            final CdiEjbBean<Object> cdiEjbBean = (CdiEjbBean<Object>)
> > > inBean;
> > > +            final CreationalContext<Object> cc =
> > > (CreationalContext<Object>) creationalContext;
> > > +
> > > +            if (scopeClass == null || Dependent.class == scopeClass) {
> > //
> > > no need to add any layer, null = @New
> > > +                return cdiEjbBean.createEjb(cc);
> > > +            }
> > > +
> > > +            // only stateful normally
> > > +            final InstanceBean<Object> bean = new
> > > InstanceBean<Object>(cdiEjbBean);
> > > +            if
> > > (webBeansContext.getBeanManagerImpl().isNormalScope(scopeClass)) {
> > > +                final BeanContext beanContext =
> > > cdiEjbBean.getBeanContext();
> > > +                final Provider provider =
> > >
> >
> webBeansContext.getNormalScopeProxyFactory().getInstanceProvider(beanContext.getClassLoader(),
> > > cdiEjbBean);
> > > +
> > > +                if (!beanContext.isLocalbean()) {
> > > +                    final List<Class> interfaces = new
> > ArrayList<Class>();
> > > +                    final InterfaceType type =
> > > beanContext.getInterfaceType(interfce);
> > > +                    if (type != null) {
> > > +
> > >  interfaces.addAll(beanContext.getInterfaces(type));
> > > +                    } else { // can happen when looked up from impl
> > > instead of API in OWB -> default to business local
> > > +
> > >
> >
>  interfaces.addAll(beanContext.getInterfaces(InterfaceType.BUSINESS_LOCAL));
> > > +                    }
> > > +                    interfaces.add(Serializable.class);
> > > +                    interfaces.add(IntraVmProxy.class);
> > > +                    if
> > > (BeanType.STATEFUL.equals(beanContext.getComponentType()) ||
> > > BeanType.MANAGED.equals(beanContext.getComponentType())) {
> > > +                        interfaces.add(BeanContext.Removable.class);
> > > +                    }
> > >
> > > -                try {
> > > -                    instance =
> > > ProxyManager.newProxyInstance(interfaces.toArray(new
> > > Class<?>[interfaces.size()]), new InvocationHandler() {
> > > -                        @Override
> > > -                        public Object invoke(final Object proxy, final
> > > Method method, final Object[] args) throws Throwable {
> > > -                            try {
> > > -                                return method.invoke(provider.get(),
> > > args);
> > > -                            } catch (final InvocationTargetException
> > ite)
> > > {
> > > -                                throw ite.getCause();
> > > +                    try {
> > > +                        instance =
> > > ProxyManager.newProxyInstance(interfaces.toArray(new
> > > Class<?>[interfaces.size()]), new InvocationHandler()
> > > +                        {
> > > +                            @Override
> > > +                            public Object invoke(final Object proxy,
> > > final Method method, final Object[] args) throws Throwable
> > > +                            {
> > > +                                try
> > > +                                {
> > > +                                    return
> method.invoke(provider.get(),
> > > args);
> > > +                                }
> > > +                                catch (final InvocationTargetException
> > > ite)
> > > +                                {
> > > +                                    throw ite.getCause();
> > > +                                }
> > >                              }
> > > -                        }
> > > -                    });
> > > -                } catch (final IllegalAccessException e) {
> > > -                    throw new OpenEJBRuntimeException(e);
> > > +                        });
> > > +                    } catch (final IllegalAccessException e) {
> > > +                        throw new OpenEJBRuntimeException(e);
> > > +                    }
> > > +
> > > +                } else {
> > > +                    final NormalScopeProxyFactory
> > normalScopeProxyFactory
> > > = webBeansContext.getNormalScopeProxyFactory();
> > > +                    final Class<?> proxyClass =
> > > normalScopeProxyFactory.createProxyClass(beanContext.getClassLoader(),
> > > beanContext.getBeanClass());
> > > +                    instance =
> > > normalScopeProxyFactory.createProxyInstance(proxyClass, provider);
> > >                  }
> > >
> > > +                cacheProxies.put(inBean, instance);
> > >              } else {
> > > -                final NormalScopeProxyFactory normalScopeProxyFactory
> =
> > > webBeansContext.getNormalScopeProxyFactory();
> > > -                final Class<?> proxyClass =
> > > normalScopeProxyFactory.createProxyClass(beanContext.getClassLoader(),
> > > beanContext.getBeanClass());
> > > -                instance =
> > > normalScopeProxyFactory.createProxyInstance(proxyClass, provider);
> > > +                final Context context =
> > > webBeansContext.getBeanManagerImpl().getContext(scopeClass);
> > > +                instance = context.get(bean, cc);
> > >              }
> > > -
> > > -            cacheProxies.put(inBean, instance);
> > > -        } else {
> > > -            final Context context =
> > > webBeansContext.getBeanManagerImpl().getContext(scopeClass);
> > > -            instance = context.get(bean, cc);
> > > +            bean.setOwbProxy(instance);
> > > +            return instance;
> > >          }
> > > -        bean.setOwbProxy(instance);
> > > -        return instance;
> > >      }
> > >
> > >      @Override
> > >
> > > Modified:
> > >
> >
> tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/BaseSessionContext.java
> > > URL:
> > >
> >
> http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/BaseSessionContext.java?rev=1593721&r1=1593720&r2=1593721&view=diff
> > >
> > >
> >
> ==============================================================================
> > > ---
> > >
> >
> tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/BaseSessionContext.java
> > > (original)
> > > +++
> > >
> >
> tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/BaseSessionContext.java
> > > Sat May 10 19:47:21 2014
> > > @@ -141,14 +141,7 @@ public abstract class BaseSessionContext
> > >              }
> > >
> > >              if (InterfaceType.LOCALBEAN.equals(interfaceType)) {
> > > -                final List<Class> interfaces = new
> ArrayList<Class>(3);
> > > -                interfaces.add(Serializable.class);
> > > -                interfaces.add(IntraVmProxy.class);
> > > -                if (BeanType.STATEFUL.equals(type) ||
> > > BeanType.MANAGED.equals(type)) {
> > > -                    interfaces.add(BeanContext.Removable.class);
> > > -                }
> > > -
> > > -                return
> > > LocalBeanProxyFactory.newProxyInstance(di.getClassLoader(), handler,
> > > di.getBeanClass(), interfaces.toArray(new
> Class<?>[interfaces.size()]));
> > > +                return
> > >
> >
> LocalBeanProxyFactory.constructProxy(di.get(BeanContext.ProxyClass.class).getProxy(),
> > > handler);
> > >              } else {
> > >                  final List<Class> interfaces = new ArrayList<Class>();
> > >                  interfaces.addAll(di.getInterfaces(interfaceType));
> > >
> > > Modified:
> > >
> >
> tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbHomeProxyHandler.java
> > > URL:
> > >
> >
> http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbHomeProxyHandler.java?rev=1593721&r1=1593720&r2=1593721&view=diff
> > >
> > >
> >
> ==============================================================================
> > > ---
> > >
> >
> tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbHomeProxyHandler.java
> > > (original)
> > > +++
> > >
> >
> tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbHomeProxyHandler.java
> > > Sat May 10 19:47:21 2014
> > > @@ -157,16 +157,7 @@ public abstract class EjbHomeProxyHandle
> > >              // TODO Is it correct for ManagedBean injection via
> managed
> > > bean class?
> > >              if ((InterfaceType.LOCALBEAN.equals(objectInterfaceType)
> ||
> > > getBeanContext().getComponentType().equals(BeanType.MANAGED))
> > >                  && !getBeanContext().isDynamicallyImplemented()) {
> > > -                final List<Class> interfaces = new
> ArrayList<Class>(3);
> > > -                interfaces.add(Serializable.class);
> > > -                interfaces.add(IntraVmProxy.class);
> > > -                if (BeanType.STATEFUL.equals(type) ||
> > > BeanType.MANAGED.equals(type)) {
> > > -                    interfaces.add(BeanContext.Removable.class);
> > > -                }
> > > -                return
> > >
> >
> LocalBeanProxyFactory.newProxyInstance(handler.getBeanContext().getClassLoader(),
> > > -                                                              handler,
> > > -
> > >  handler.getBeanContext().getBeanClass(),
> > > -
> > >  interfaces.toArray(new Class<?>[interfaces.size()]));
> > > +                return
> > >
> >
> LocalBeanProxyFactory.constructProxy(handler.getBeanContext().get(BeanContext.ProxyClass.class).getProxy(),
> > > handler);
> > >              } else {
> > >                  final List<Class> proxyInterfaces = new
> > > ArrayList<Class>(handler.getInterfaces().size() + 2);
> > >                  proxyInterfaces.addAll(handler.getInterfaces());
> > >
> > > Modified:
> > >
> >
> tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/EndpointFactory.java
> > > URL:
> > >
> >
> http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/EndpointFactory.java?rev=1593721&r1=1593720&r2=1593721&view=diff
> > >
> > >
> >
> ==============================================================================
> > > ---
> > >
> >
> tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/EndpointFactory.java
> > > (original)
> > > +++
> > >
> >
> tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/EndpointFactory.java
> > > Sat May 10 19:47:21 2014
> > > @@ -67,8 +67,8 @@ public class EndpointFactory implements
> > >          }
> > >          final EndpointHandler endpointHandler = new
> > > EndpointHandler(container, beanContext, instanceFactory, xaResource);
> > >          try {
> > > -            return (MessageEndpoint)
> > > LocalBeanProxyFactory.newProxyInstance(beanContext.getClassLoader(),
> > > endpointHandler, beanContext.getBeanClass(), interfaces);
> > > -        } catch (final InternalError e) {
> > > +            return (MessageEndpoint)
> > >
> >
> LocalBeanProxyFactory.constructProxy(beanContext.get(BeanContext.ProxyClass.class).getProxy(),
> > > endpointHandler);
> > > +        } catch (final InternalError e) { // should be useless
> > >              //try to create the proxy with tccl once again.
> > >              try {
> > >                  return
> > >
> >
> MessageEndpoint.class.cast(LocalBeanProxyFactory.newProxyInstance(Thread.currentThread().getContextClassLoader(),
> > > endpointHandler, beanContext.getBeanClass(), interfaces));
> > >
> > >
> > >
> >
>

Reply via email to