tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: r1032857 - in /openejb/trunk/openejb3/container/openejb-core/src/main: java/org/apache/openejb/assembler/classic/ java/org/apache/openejb/config/ resources/org/apache/openejb/assembler/classic/
Date Tue, 09 Nov 2010 06:09:56 GMT
Author: dblevins
Date: Tue Nov  9 06:09:55 2010
New Revision: 1032857

URL: http://svn.apache.org/viewvc?rev=1032857&view=rev
Log:
merged some persistence time logging changes from 3.1.x

Modified:
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/PersistenceBuilder.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AppInfoBuilder.java
    openejb/trunk/openejb3/container/openejb-core/src/main/resources/org/apache/openejb/assembler/classic/Messages.properties

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/PersistenceBuilder.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/PersistenceBuilder.java?rev=1032857&r1=1032856&r2=1032857&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/PersistenceBuilder.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/PersistenceBuilder.java
Tue Nov  9 06:09:55 2010
@@ -18,6 +18,7 @@ package org.apache.openejb.assembler.cla
 
 import java.util.HashMap;
 import java.util.Map;
+import java.util.concurrent.TimeUnit;
 import javax.persistence.EntityManagerFactory;
 import javax.persistence.spi.PersistenceProvider;
 import javax.persistence.spi.PersistenceUnitTransactionType;
@@ -188,18 +189,22 @@ public class PersistenceBuilder {
         }
         unitInfo.setPersistenceProviderClassName(persistenceProviderClassName);
 
-        Class clazz = classLoader.loadClass(persistenceProviderClassName);
-        PersistenceProvider persistenceProvider = (PersistenceProvider) clazz.newInstance();
-
-        logger.info("assembler.buildingPersistenceUnit", unitInfo.getPersistenceUnitName(),
unitInfo.getPersistenceProviderClassName(), unitInfo.getPersistenceUnitRootUrl(), unitInfo.getTransactionType());
-        if (logger.isDebugEnabled()) {
-            for (Map.Entry<Object, Object> entry : unitInfo.getProperties().entrySet())
{
-                logger.debug(entry.getKey() + "=" + entry.getValue());
+        final long start = System.nanoTime();
+        try {
+            Class clazz = classLoader.loadClass(persistenceProviderClassName);
+            PersistenceProvider persistenceProvider = (PersistenceProvider) clazz.newInstance();
+
+            // Create entity manager factory
+            EntityManagerFactory emf = persistenceProvider.createContainerEntityManagerFactory(unitInfo,
new HashMap());
+            return emf;
+        } finally {
+            final long time = TimeUnit.MILLISECONDS.convert(System.nanoTime() - start, TimeUnit.NANOSECONDS);
+            logger.info("assembler.buildingPersistenceUnit", unitInfo.getPersistenceUnitName(),
unitInfo.getPersistenceProviderClassName(), time+"");
+            if (logger.isDebugEnabled()) {
+                for (Map.Entry<Object, Object> entry : unitInfo.getProperties().entrySet())
{
+                    logger.debug(entry.getKey() + "=" + entry.getValue());
+                }
             }
         }
-
-        // Create entity manager factory
-        EntityManagerFactory emf = persistenceProvider.createContainerEntityManagerFactory(unitInfo,
new HashMap());
-        return emf;
     }
 }

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AppInfoBuilder.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AppInfoBuilder.java?rev=1032857&r1=1032856&r2=1032857&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AppInfoBuilder.java
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AppInfoBuilder.java
Tue Nov  9 06:09:55 2010
@@ -590,8 +590,8 @@ class AppInfoBuilder {
                 final Set<String> keys = new HashSet<String>(info.properties.stringPropertyNames());
                 for (String key : keys) {
                     if (key.matches("openjpa.Connection(DriverName|URL|UserName|Password)"))
{
-                        info.properties.remove(key);
-                        logger.warning("Removing PersistenceUnit(name=" + info.name + ")
property " + property + "=" + value + "  [not valid in a container environment]");
+                        final Object o = info.properties.remove(key);
+                        logger.warning("Removing PersistenceUnit(name=" + info.name + ")
property " + key + "=" + o + "  [not valid in a container environment]");
                     }
                 }
             }

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/resources/org/apache/openejb/assembler/classic/Messages.properties
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/resources/org/apache/openejb/assembler/classic/Messages.properties?rev=1032857&r1=1032856&r2=1032857&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/resources/org/apache/openejb/assembler/classic/Messages.properties
(original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/resources/org/apache/openejb/assembler/classic/Messages.properties
Tue Nov  9 06:09:55 2010
@@ -36,7 +36,7 @@ assembler.invalidConnectionManager=Inval
 
 # PersistenceBuilder.java
 # logger.info("assembler.buildingPersistenceUnit", unitInfo.getPersistenceUnitName(), unitInfo.getPersistenceProviderClassName(),
unitInfo.getPersistenceUnitRootUrl(), unitInfo.getTransactionType());
-assembler.buildingPersistenceUnit = PersistenceUnit(name={0}, provider={1})
+assembler.buildingPersistenceUnit = PersistenceUnit(name={0}, provider={1}) - provider time
{2}ms
 
 # Assembler
 # buildContainerSystem(OpenEjbConfiguration)



Mime
View raw message