tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject tomee git commit: TOMEE-2069 ValidatorFactoryWrapper can be slow due to JNDI usage
Date Tue, 20 Jun 2017 07:44:23 GMT
Repository: tomee
Updated Branches:
  refs/heads/master e1e10296b -> e8dbf1ffa


TOMEE-2069 ValidatorFactoryWrapper can be slow due to JNDI usage


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

Branch: refs/heads/master
Commit: e8dbf1ffaf39a6bbcdaf19fc80b8cbdf8529dd0e
Parents: e1e1029
Author: rmannibucau <rmannibucau@apache.org>
Authored: Tue Jun 20 09:44:13 2017 +0200
Committer: rmannibucau <rmannibucau@apache.org>
Committed: Tue Jun 20 09:44:13 2017 +0200

----------------------------------------------------------------------
 .../openejb/assembler/classic/EntityManagerFactoryCallable.java | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/e8dbf1ff/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EntityManagerFactoryCallable.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EntityManagerFactoryCallable.java
b/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EntityManagerFactoryCallable.java
index 22cd810..03ff669 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EntityManagerFactoryCallable.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/EntityManagerFactoryCallable.java
@@ -87,7 +87,10 @@ public class EntityManagerFactoryCallable implements Callable<EntityManagerFacto
             // Create entity manager factories with the validator factory
             final Map<String, Object> properties = new HashMap<String, Object>();
             if (!ValidationMode.NONE.equals(unitInfo.getValidationMode())) {
-                properties.put("javax.persistence.validation.factory", new ValidatorFactoryWrapper(potentialValidators));
+                properties.put("javax.persistence.validation.factory",
+                        potentialValidators != null && potentialValidators.size()
== 1 ? // optim to avoid lookups
+                                potentialValidators.values().iterator().next() :
+                                new ValidatorFactoryWrapper(potentialValidators));
             }
             if (cdi && "true".equalsIgnoreCase(unitInfo.getProperties().getProperty("tomee.jpa.cdi",
"true"))
                     && "true".equalsIgnoreCase(SystemInstance.get().getProperty("tomee.jpa.cdi",
"true"))) {


Mime
View raw message