openwebbeans-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Struberg <strub...@yahoo.de>
Subject Re: svn commit: r1409751 - in /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy: ProxyFactory.java javassist/JavassistFactory.java
Date Thu, 15 Nov 2012 13:50:24 GMT
Actually that code is used in TomEE afaik. We might think about better separation between CDI
and EJB in the end.

Also this part would need unit test - another argument for creating a JIRA.

LieGrue,
strub




----- Original Message -----
> From: Gurkan Erdogdu <gurkanerdogdu@yahoo.com>
> To: "dev@openwebbeans.apache.org" <dev@openwebbeans.apache.org>
> Cc: 
> Sent: Thursday, November 15, 2012 2:16 PM
> Subject: Re: svn commit: r1409751 - in /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy:
ProxyFactory.java javassist/JavassistFactory.java
> 
> Hey Mark
> 
> 
> I don't think to create JIRA issues for every commit.  I think that this is 
> not a big change, this method is not used in anywhere in the codebase and only 
> used for EJB purposes. Someone removed this code while removing Javassist 
> functionality and introduces regression. Sure to always open for a big changes!
> 
> 
> Gurkan
> 
> 
> 
> ________________________________
> Kimden: Mark Struberg <struberg@yahoo.de>
> Kime: "dev@openwebbeans.apache.org" 
> <dev@openwebbeans.apache.org> 
> Gönderildiği Tarih: 15 Kasım 2012 15:10 Perşembe
> Konu: Re: svn commit: r1409751 - in 
> /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy: 
> ProxyFactory.java javassist/JavassistFactory.java
> 
> Gurkan, please create a JIRA for all other than cosmetical changes!
> This is a pretty big change internally and really requires a JIRA entry.
> 
> txs and LieGrue,
> strub
> 
> 
> 
> ----- Original Message -----
>>  From: "gerdogdu@apache.org" <gerdogdu@apache.org>
>>  To: commits@openwebbeans.apache.org
>>  Cc: 
>>  Sent: Thursday, November 15, 2012 1:25 PM
>>  Subject: svn commit: r1409751 - in 
> /openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy: 
> ProxyFactory.java javassist/JavassistFactory.java
>> 
>>  Author: gerdogdu
>>  Date: Thu Nov 15 12:25:17 2012
>>  New Revision: 1409751
>> 
>>  URL: http://svn.apache.org/viewvc?rev=1409751&view=rev
>>  Log:
>>  Regression in Javassist remove updates
>> 
>>  Modified:
>>      
>> 
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/ProxyFactory.java
>>      
>> 
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/javassist/JavassistFactory.java
>> 
>>  Modified: 
>> 
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/ProxyFactory.java
>>  URL: 
>> 
> http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/ProxyFactory.java?rev=1409751&r1=1409750&r2=1409751&view=diff
>> 
> ==============================================================================
>>  --- 
>> 
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/ProxyFactory.java

> 
>>  (original)
>>  +++ 
>> 
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/ProxyFactory.java

> 
>>  Thu Nov 15 12:25:17 2012
>>  @@ -22,6 +22,7 @@ import java.io.Serializable;
>>  import java.lang.reflect.Constructor;
>>  import java.lang.reflect.InvocationTargetException;
>>  import java.lang.reflect.Type;
>>  +import java.util.ArrayList;
>>  import java.util.HashSet;
>>  import java.util.Iterator;
>>  import java.util.List;
>>  @@ -106,12 +107,60 @@ public final class ProxyFactory
>>        */
>>       public Class<?> getEjbBeanProxyClass(OwbBean<?> bean, 
>>  Class<?> iface)
>>       {
>>  +        Class<?> proxyClass = null;
>>  +
>>           ConcurrentMap<Class<?>, Class<?>> 
> typeToProxyClassMap 
>>  = ejbProxyClasses.get(bean);
>>  -        if (typeToProxyClassMap != null)
>>  +        if (typeToProxyClassMap == null)
>>           {
>>  -            return typeToProxyClassMap.get(iface);
>>  +            typeToProxyClassMap = new ConcurrentHashMap<Class<?>,

> 
>>  Class<?>>();
>>  +            ConcurrentMap<Class<?>, Class<?>> 
> existingMap = 
>>  ejbProxyClasses.putIfAbsent(bean, typeToProxyClassMap);
>>  +            
>>  +            // use the map that beat us, because our new one definitely 
> had no 
>>  classes in it.
>>  +            typeToProxyClassMap = (existingMap != null) ? existingMap : 
>>  typeToProxyClassMap; 
>>           }
>>  -        return null;
>>  +
>>  +        proxyClass = typeToProxyClassMap.get(iface);
>>  +
>>  +        if (proxyClass == null)
>>  +        {
>>  +            Class<?> superClazz = null;
>>  +            List<Class<?>> list = new 
>>  ArrayList<Class<?>>();
>>  +            Class<?>[] interfaces = null;
>>  +            
>>  +            if (iface.isInterface())
>>  +            {
>>  +                list.add(iface);
>>  +            }
>>  +            else 
>>  +            {
>>  +                // @LocalBean no-interface local view requested
>>  +                superClazz = iface;
>>  +                //Stateless beans with no interface
>>  +                //To failover bean instance
>>  +                Class<?>[] ifaces = iface.getInterfaces();
>>  +                if(ifaces != null && ifaces.length > 0)
>>  +                {
>>  +                    //check for serializable
>>  +                    for(Class<?> temp : ifaces)
>>  +                    {
>>  +                        if(temp == Serializable.class)
>>  +                        {
>>  +                            list.add(Serializable.class);
>>  +                            break;
>>  +                        }
>>  +                    }
>>  +                }
>>  +            }            
>>  +            
>>  +            interfaces = new Class<?>[list.size()];
>>  +            interfaces = list.toArray(interfaces);
>>  +            proxyClass = factory.getProxyClass(superClazz, interfaces);
>>  +            
>>  +            typeToProxyClassMap.putIfAbsent(iface, proxyClass);
>>  +            // don't care if we were beaten in updating the 
>>  iface->proxyclass map
>>  +        }
>>  +
>>  +        return proxyClass;
>>       }
>>      
>>       public Object createDecoratorDelegate(OwbBean<?> bean, 
>>  DelegateHandler newDelegateHandler)
>> 
>>  Modified: 
>> 
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/javassist/JavassistFactory.java
>>  URL: 
>> 
> http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/javassist/JavassistFactory.java?rev=1409751&r1=1409750&r2=1409751&view=diff
>> 
> ==============================================================================
>>  --- 
>> 
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/javassist/JavassistFactory.java

> 
>>  (original)
>>  +++ 
>> 
> openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/javassist/JavassistFactory.java

> 
>>  Thu Nov 15 12:25:17 2012
>>  @@ -38,7 +38,10 @@ public class JavassistFactory
>>       {
>>           ProxyFactory fact = new ProxyFactory();
>>           fact.setInterfaces(interfaces);
>>  -        fact.setSuperclass(superClass);
>>  +        if(superClass != null)
>>  +        {
>>  +            fact.setSuperclass(superClass);  
>>  +        }
>>           fact.setFilter(FinalizeMethodFilter.INSTANCE);
>> 
>>           return getProxyClass(fact);
>> 
> 

Mime
View raw message