openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From curti...@apache.org
Subject svn commit: r1458027 - /openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/DetachManagerLite.java
Date Mon, 18 Mar 2013 21:45:28 GMT
Author: curtisr7
Date: Mon Mar 18 21:45:28 2013
New Revision: 1458027

URL: http://svn.apache.org/r1458027
Log:
OPENJPA-2353: Reduce object allocations in DetachManagerLite.

Modified:
    openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/DetachManagerLite.java

Modified: openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/DetachManagerLite.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/DetachManagerLite.java?rev=1458027&r1=1458026&r2=1458027&view=diff
==============================================================================
--- openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/DetachManagerLite.java
(original)
+++ openjpa/branches/2.2.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/DetachManagerLite.java
Mon Mar 18 21:45:28 2013
@@ -32,9 +32,11 @@ import org.apache.openjpa.util.Proxy;
  */
 public class DetachManagerLite {
     private final boolean _detachProxies;
+    private final TransferFieldManager _tsm;
 
-    public DetachManagerLite(OpenJPAConfiguration conf) {
+    public DetachManagerLite(OpenJPAConfiguration conf) {       
         _detachProxies = conf.getDetachStateInstance().getDetachProxyFields();
+        _tsm = new TransferFieldManager();
     }
 
     /**
@@ -44,7 +46,7 @@ public class DetachManagerLite {
      *            The StateManagers to be detached.
      */
     public void detachAll(Collection<StateManagerImpl> states) {
-        TransferFieldManager fm = new TransferFieldManager();
+        
         for (StateManagerImpl sm : states) {
             ClassMetaData cmd = sm.getMetaData();
             if (sm.isPersistent() && cmd.isDetachable()) {
@@ -54,7 +56,7 @@ public class DetachManagerLite {
                     BitSet loaded = sm.getLoaded();
                     for (FieldMetaData fmd : cmd.getProxyFields()) {
                         if (loaded.get(fmd.getIndex())) {
-                            detachProxyField(fmd, pc, sm, fm);
+                            detachProxyField(fmd, pc, sm, _tsm);
                         }
                     }
                     pc.pcReplaceStateManager(null);



Mime
View raw message