openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gerdo...@apache.org
Subject svn commit: r1414153 - in /openwebbeans/branches/owb_1.1.x: webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/proxy/ webbeans-impl/src/main/java/org/apache/webbeans/proxy/ webbeans-impl/src/main/java/org/apache/webbeans/proxy/javassist/
Date Tue, 27 Nov 2012 12:37:59 GMT
Author: gerdogdu
Date: Tue Nov 27 12:37:58 2012
New Revision: 1414153

URL: http://svn.apache.org/viewvc?rev=1414153&view=rev
Log:
Committing r1409751, r1409721 from trunk to maintained branch 1_1_x

Modified:
    openwebbeans/branches/owb_1.1.x/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/proxy/
  (props changed)
    openwebbeans/branches/owb_1.1.x/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/proxy/EjbBeanProxyHandler.java
    openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/
  (props changed)
    openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/ProxyFactory.java
    openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/javassist/JavassistFactory.java

Propchange: openwebbeans/branches/owb_1.1.x/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/proxy/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Tue Nov 27 12:37:58 2012
@@ -0,0 +1 @@
+/openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/proxy:1407086-1407263,1408825-1408835,1409721

Modified: openwebbeans/branches/owb_1.1.x/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/proxy/EjbBeanProxyHandler.java
URL: http://svn.apache.org/viewvc/openwebbeans/branches/owb_1.1.x/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/proxy/EjbBeanProxyHandler.java?rev=1414153&r1=1414152&r2=1414153&view=diff
==============================================================================
--- openwebbeans/branches/owb_1.1.x/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/proxy/EjbBeanProxyHandler.java
(original)
+++ openwebbeans/branches/owb_1.1.x/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/proxy/EjbBeanProxyHandler.java
Tue Nov 27 12:37:58 2012
@@ -58,21 +58,21 @@ import org.apache.webbeans.proxy.MethodH
 public class EjbBeanProxyHandler implements InvocationHandler, MethodHandler, Serializable,
Externalizable
 {
     //Logger instance
-    private final static Logger logger = WebBeansLoggerFacade.getLogger(EjbBeanProxyHandler.class);
+    protected final static Logger logger = WebBeansLoggerFacade.getLogger(EjbBeanProxyHandler.class);
     
     /**Proxy ejb bean instance*/
-    private BaseEjbBean<?> ejbBean;
+    protected BaseEjbBean<?> ejbBean;
     
     /**Dependent ejb instance*/
-    private Object dependentEJB;
+    protected Object dependentEJB;
     
     /**Scope is dependent*/
-    private boolean isDependent = false;
+    protected boolean isDependent = false;
     
     /**Creational Context*/
-    private CreationalContext<?> creationalContext;
+    protected CreationalContext<?> creationalContext;
 
-    private WebBeansContext webBeansContext;
+    protected WebBeansContext webBeansContext;
 
     //DO NOT REMOVE, used by PASSIVATION.
     public EjbBeanProxyHandler() 
@@ -86,8 +86,9 @@ public class EjbBeanProxyHandler impleme
     public EjbBeanProxyHandler(BaseEjbBean<?> ejbBean, CreationalContext<?> creationalContext)
     {
         this.ejbBean = ejbBean;
-
-        if(ejbBean.getWebBeansContext().getWebBeansUtil().isScopeTypeNormal(ejbBean.getScope()))
+        this.webBeansContext = ejbBean.getWebBeansContext();
+        
+        if(this.webBeansContext.getWebBeansUtil().isScopeTypeNormal(ejbBean.getScope()))
         {
             initiateBeanBag((OwbBean<Object>)ejbBean, (CreationalContext<Object>)creationalContext);
         }
@@ -101,7 +102,6 @@ public class EjbBeanProxyHandler impleme
             isDependent = true;
             dependentEJB = null;
         }
-        webBeansContext = ejbBean.getWebBeansContext();
     }
     
     public Object invoke(Object instance, Method method, Method proceed, Object[] arguments)
throws Throwable

Propchange: openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Tue Nov 27 12:37:58 2012
@@ -0,0 +1 @@
+/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy:1407086-1407263,1408825-1408835,1409751

Modified: openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/ProxyFactory.java
URL: http://svn.apache.org/viewvc/openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/ProxyFactory.java?rev=1414153&r1=1414152&r2=1414153&view=diff
==============================================================================
--- openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/ProxyFactory.java
(original)
+++ openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/ProxyFactory.java
Tue Nov 27 12:37:58 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/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/javassist/JavassistFactory.java
URL: http://svn.apache.org/viewvc/openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/javassist/JavassistFactory.java?rev=1414153&r1=1414152&r2=1414153&view=diff
==============================================================================
--- openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/javassist/JavassistFactory.java
(original)
+++ openwebbeans/branches/owb_1.1.x/webbeans-impl/src/main/java/org/apache/webbeans/proxy/javassist/JavassistFactory.java
Tue Nov 27 12:37:58 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