tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject tomee git commit: useless extension point and conditional branch (yeah, idea can be wrong ; ))
Date Fri, 10 Feb 2017 08:19:46 GMT
Repository: tomee
Updated Branches:
  refs/heads/master 56bea6caa -> 51bf8b649


useless extension point and conditional branch (yeah, idea can be wrong ;))


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/51bf8b64
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/51bf8b64
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/51bf8b64

Branch: refs/heads/master
Commit: 51bf8b649cf8875f03abf64b688c6134550f7773
Parents: 56bea6c
Author: rmannibucau <rmannibucau@apache.org>
Authored: Fri Feb 10 09:19:35 2017 +0100
Committer: rmannibucau <rmannibucau@apache.org>
Committed: Fri Feb 10 09:19:35 2017 +0100

----------------------------------------------------------------------
 .../server/cxf/rs/CdiResourceProvider.java      | 22 ++++++--------------
 .../cxf/rs/CdiSingletonResourceProvider.java    | 10 ---------
 .../OpenEJBPerRequestPojoResourceProvider.java  | 11 ----------
 3 files changed, 6 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/51bf8b64/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CdiResourceProvider.java
----------------------------------------------------------------------
diff --git a/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CdiResourceProvider.java
b/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CdiResourceProvider.java
index bf5b28a..2fcbf04 100644
--- a/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CdiResourceProvider.java
+++ b/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CdiResourceProvider.java
@@ -156,10 +156,10 @@ public abstract class CdiResourceProvider implements ResourceProvider
{
             if (normalScopeCreator != null) {
                 creator = normalScopeCreator;
             } else {
-                creator = getPseudoScopedCdiBeanCreator();
+                creator = new PseudoScopedCdiBeanCreator();
             }
         } else {
-            creator = getDefaultBeanCreator(m);
+            creator = new DefaultBeanCreator(m, constructor);
         }
         m.put(BeanCreator.class, creator);
         m.put(CdiResourceProvider.class, this);
@@ -184,10 +184,6 @@ public abstract class CdiResourceProvider implements ResourceProvider
{
         return instance;
     }
 
-    protected abstract BeanCreator getDefaultBeanCreator(Message m);
-
-    protected abstract BeanCreator getPseudoScopedCdiBeanCreator();
-
     @Override // this method is not linked to o to consider it stateless
     public void releaseInstance(final Message m, final Object o) {
         final BeanCreator c = m.get(BeanCreator.class);
@@ -286,12 +282,8 @@ public abstract class CdiResourceProvider implements ResourceProvider
{
         @Override
         public Object create() {
             try {
-                if (null != bean) {
-                    toClean = bm.createCreationalContext(bean);
-                    return bm.getReference(bean, bean.getBeanClass(), toClean);
-                } else {
-                    throw new InjectionException("Bean is null for: " + clazz.getName());
-                }
+                toClean = bm.createCreationalContext(bean);
+                return bm.getReference(bean, bean.getBeanClass(), toClean);
             } catch (final InjectionException ie) {
                 final String msg = "Failed to instantiate: " + bean;
                 Logger.getInstance(LogCategory.OPENEJB_CDI, this.getClass()).error(msg, ie);
@@ -301,10 +293,8 @@ public abstract class CdiResourceProvider implements ResourceProvider
{
 
         @Override
         public void release() {
-            if (null != toClean) {
-                toClean.release();
-                toClean = null;
-            }
+            toClean.release();
+            toClean = null;
         }
     }
 

http://git-wip-us.apache.org/repos/asf/tomee/blob/51bf8b64/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CdiSingletonResourceProvider.java
----------------------------------------------------------------------
diff --git a/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CdiSingletonResourceProvider.java
b/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CdiSingletonResourceProvider.java
index 576a663..4ee5b1c 100644
--- a/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CdiSingletonResourceProvider.java
+++ b/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/CdiSingletonResourceProvider.java
@@ -39,16 +39,6 @@ public class CdiSingletonResourceProvider extends CdiResourceProvider {
     }
 
     @Override
-    protected BeanCreator getDefaultBeanCreator(final Message m) {
-        return new CdiResourceProvider.DefaultBeanCreator(m, constructor);
-    }
-
-    @Override
-    protected BeanCreator getPseudoScopedCdiBeanCreator() {
-        return new CdiResourceProvider.PseudoScopedCdiBeanCreator();
-    }
-
-    @Override
     public boolean isSingleton() {
         return true;
     }

http://git-wip-us.apache.org/repos/asf/tomee/blob/51bf8b64/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/OpenEJBPerRequestPojoResourceProvider.java
----------------------------------------------------------------------
diff --git a/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/OpenEJBPerRequestPojoResourceProvider.java
b/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/OpenEJBPerRequestPojoResourceProvider.java
index a941e4a..0bfed8d 100644
--- a/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/OpenEJBPerRequestPojoResourceProvider.java
+++ b/server/openejb-cxf-rs/src/main/java/org/apache/openejb/server/cxf/rs/OpenEJBPerRequestPojoResourceProvider.java
@@ -16,7 +16,6 @@
  */
 package org.apache.openejb.server.cxf.rs;
 
-import org.apache.cxf.message.Message;
 import org.apache.openejb.Injection;
 import org.apache.webbeans.config.WebBeansContext;
 
@@ -27,14 +26,4 @@ public class OpenEJBPerRequestPojoResourceProvider extends CdiResourceProvider
{
     public OpenEJBPerRequestPojoResourceProvider(final ClassLoader loader, final Class<?>
clazz, final Collection<Injection> injectionCollection, final Context initialContext,
final WebBeansContext owbCtx) {
         super(loader, clazz, injectionCollection, initialContext, owbCtx);
     }
-
-    @Override
-    protected BeanCreator getDefaultBeanCreator(final Message m) {
-        return new DefaultBeanCreator(m, constructor);
-    }
-
-    @Override
-    protected BeanCreator getPseudoScopedCdiBeanCreator() {
-        return new PseudoScopedCdiBeanCreator();
-    }
 }


Mime
View raw message