deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tandrasc...@apache.org
Subject [3/3] deltaspike git commit: DELTASPIKE-1164 [perf] QueryBuilder can be ApplicationScoped
Date Thu, 02 Jun 2016 21:47:41 GMT
DELTASPIKE-1164 [perf] QueryBuilder can be ApplicationScoped

Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/70299c16
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/70299c16
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/70299c16

Branch: refs/heads/master
Commit: 70299c16d60eb47ced53d68a4dbc101326e910bb
Parents: d94bce7
Author: Thomas Andraschko <tandraschko@apache.org>
Authored: Thu Jun 2 23:41:39 2016 +0200
Committer: Thomas Andraschko <tandraschko@apache.org>
Committed: Thu Jun 2 23:41:39 2016 +0200

----------------------------------------------------------------------
 .../data/impl/builder/AnnotatedQueryBuilder.java          |  2 ++
 .../data/impl/builder/DelegateQueryBuilder.java           |  2 ++
 .../deltaspike/data/impl/builder/MethodQueryBuilder.java  |  2 ++
 .../deltaspike/data/impl/builder/QueryBuilderFactory.java | 10 +++-------
 .../apache/deltaspike/data/impl/handler/QueryHandler.java |  4 ++--
 5 files changed, 11 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/70299c16/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/AnnotatedQueryBuilder.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/AnnotatedQueryBuilder.java
b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/AnnotatedQueryBuilder.java
index 1d8b0d5..9e7cba2 100644
--- a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/AnnotatedQueryBuilder.java
+++ b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/AnnotatedQueryBuilder.java
@@ -27,6 +27,7 @@ import org.apache.deltaspike.data.impl.util.jpa.QueryStringExtractorFactory;
 
 import javax.persistence.EntityManager;
 import java.lang.reflect.Method;
+import javax.enterprise.context.ApplicationScoped;
 
 import static org.apache.deltaspike.core.util.StringUtils.isNotEmpty;
 
@@ -34,6 +35,7 @@ import static org.apache.deltaspike.core.util.StringUtils.isNotEmpty;
  * Create the query based on method annotations.
  */
 @QueryInvocation(MethodType.ANNOTATED)
+@ApplicationScoped
 public class AnnotatedQueryBuilder extends QueryBuilder
 {
 

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/70299c16/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/DelegateQueryBuilder.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/DelegateQueryBuilder.java
b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/DelegateQueryBuilder.java
index 99ccf87..c97dc14 100644
--- a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/DelegateQueryBuilder.java
+++ b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/DelegateQueryBuilder.java
@@ -21,6 +21,7 @@ package org.apache.deltaspike.data.impl.builder;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.util.Set;
+import javax.enterprise.context.ApplicationScoped;
 
 import javax.enterprise.context.Dependent;
 import javax.enterprise.context.spi.CreationalContext;
@@ -39,6 +40,7 @@ import org.apache.deltaspike.data.impl.util.bean.BeanDestroyable;
 import org.apache.deltaspike.data.spi.DelegateQueryHandler;
 
 @QueryInvocation(MethodType.DELEGATE)
+@ApplicationScoped
 public class DelegateQueryBuilder extends QueryBuilder
 {
     @Inject

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/70299c16/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/MethodQueryBuilder.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/MethodQueryBuilder.java
b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/MethodQueryBuilder.java
index 4aa8b30..850d97f 100644
--- a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/MethodQueryBuilder.java
+++ b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/MethodQueryBuilder.java
@@ -18,6 +18,7 @@
  */
 package org.apache.deltaspike.data.impl.builder;
 
+import javax.enterprise.context.ApplicationScoped;
 import javax.persistence.Query;
 
 import org.apache.deltaspike.data.impl.builder.part.QueryRoot;
@@ -27,6 +28,7 @@ import org.apache.deltaspike.data.impl.meta.QueryInvocation;
 import org.apache.deltaspike.data.impl.param.Parameters;
 
 @QueryInvocation(MethodType.PARSE)
+@ApplicationScoped
 public class MethodQueryBuilder extends QueryBuilder
 {
 

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/70299c16/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/QueryBuilderFactory.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/QueryBuilderFactory.java
b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/QueryBuilderFactory.java
index be1eaa1..9c5625d 100644
--- a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/QueryBuilderFactory.java
+++ b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/builder/QueryBuilderFactory.java
@@ -27,18 +27,15 @@ import java.util.Map;
 import javax.enterprise.context.ApplicationScoped;
 
 import org.apache.deltaspike.core.api.provider.BeanProvider;
-import org.apache.deltaspike.core.api.provider.DependentProvider;
 import org.apache.deltaspike.data.api.QueryResult;
 import org.apache.deltaspike.data.impl.handler.CdiQueryInvocationContext;
 import org.apache.deltaspike.data.impl.meta.MethodType;
 import org.apache.deltaspike.data.impl.meta.QueryInvocationLiteral;
 import org.apache.deltaspike.data.impl.meta.RepositoryMethod;
-import org.apache.deltaspike.data.impl.util.bean.DependentProviderDestroyable;
 
 @ApplicationScoped
 public class QueryBuilderFactory
 {
-
     private static final Map<MethodType, QueryInvocationLiteral> LITERALS =
             new HashMap<MethodType, QueryInvocationLiteral>()
             {
@@ -53,14 +50,13 @@ public class QueryBuilderFactory
 
     public QueryBuilder build(RepositoryMethod method, CdiQueryInvocationContext context)
     {
-        DependentProvider<QueryBuilder> builder = BeanProvider.getDependent(
+        QueryBuilder builder = BeanProvider.getContextualReference(
                 QueryBuilder.class, LITERALS.get(method.getMethodType()));
-        context.addDestroyable(new DependentProviderDestroyable(builder));
         if (method.returns(QueryResult.class))
         {
-            return new WrappedQueryBuilder(builder.get());
+            return new WrappedQueryBuilder(builder);
         }
-        return builder.get();
+        return builder;
     }
 
 }

http://git-wip-us.apache.org/repos/asf/deltaspike/blob/70299c16/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/QueryHandler.java
----------------------------------------------------------------------
diff --git a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/QueryHandler.java
b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/QueryHandler.java
index b29613f..d83e227 100755
--- a/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/QueryHandler.java
+++ b/deltaspike/modules/data/impl/src/main/java/org/apache/deltaspike/data/impl/handler/QueryHandler.java
@@ -60,7 +60,7 @@ public class QueryHandler implements Serializable, InvocationHandler
     private static final Logger log = Logger.getLogger(QueryHandler.class.getName());
 
     @Inject
-    private QueryBuilderFactory queryBuilder;
+    private QueryBuilderFactory queryBuilderFactory;
 
     @Inject
     @Initialized
@@ -143,7 +143,7 @@ public class QueryHandler implements Serializable, InvocationHandler
             entityManagerRef = entityManagerRefLookup.lookupReference(repo);
             queryContext = createContext(proxy, method, args, entityManagerRef.getEntityManager(),
repoMethod);
             
-            QueryBuilder builder = queryBuilder.build(repoMethod, queryContext);
+            QueryBuilder builder = queryBuilderFactory.build(repoMethod, queryContext);
             Object result = runner.executeQuery(builder, queryContext);
             return result;
         }


Mime
View raw message