openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From curti...@apache.org
Subject svn commit: r888513 - in /openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc: kernel/JDBCStoreManager.java meta/strats/RelationFieldStrategy.java
Date Tue, 08 Dec 2009 18:46:41 GMT
Author: curtisr7
Date: Tue Dec  8 18:46:40 2009
New Revision: 888513

URL: http://svn.apache.org/viewvc?rev=888513&view=rev
Log:
OPENJPA-1421: Reduce lock contention in JDBCStoreManager

Modified:
    openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java
    openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/RelationFieldStrategy.java

Modified: openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java?rev=888513&r1=888512&r2=888513&view=diff
==============================================================================
--- openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java
(original)
+++ openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/JDBCStoreManager.java
Tue Dec  8 18:46:40 2009
@@ -502,15 +502,19 @@
         if (sel == null) return null;
         return sel.execute(this, fetch, params);
     }
-
+    
+    Map<SelectKey, Select> selectImplCacheMap = null;
     private Select newSelect(OpenJPAStateManager sm,
         ClassMapping mapping, JDBCFetchConfiguration fetch, int subs,
         List params) {
         if (!_isQuerySQLCache) 
             return newSelect(sm, mapping, fetch, subs);       
            
-        Map<SelectKey, Select> selectImplCacheMap = 
-            getCacheMapFromQuerySQLCache(JDBCStoreManager.class);
+        if (selectImplCacheMap == null) {
+            selectImplCacheMap =
+                getCacheMapFromQuerySQLCache(JDBCStoreManager.class);
+        }
+         
         JDBCFetchConfiguration fetchClone = new JDBCFetchConfigurationImpl();
         fetchClone.copy(fetch);
         SelectKey selKey = new SelectKey(mapping, null, fetchClone);

Modified: openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/RelationFieldStrategy.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/RelationFieldStrategy.java?rev=888513&r1=888512&r2=888513&view=diff
==============================================================================
--- openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/RelationFieldStrategy.java
(original)
+++ openjpa/branches/1.2.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/meta/strats/RelationFieldStrategy.java
Tue Dec  8 18:46:40 2009
@@ -598,7 +598,8 @@
         else
             sm.setIntermediate(field.getIndex(), oid);
     }
-
+    
+    Map<JDBCStoreManager.SelectKey, Object[]> relationFieldUnionCache = null;
     public void load(final OpenJPAStateManager sm, final JDBCStore store,
         final JDBCFetchConfiguration fetch)
         throws SQLException {
@@ -625,9 +626,11 @@
         if (!((JDBCStoreManager)store).isQuerySQLCacheOn())
             union = newUnion(sm, store, fetch, rels, subs, resJoins);
         else {
-            Map<JDBCStoreManager.SelectKey, Object[]> relationFieldUnionCache = 
-                ((JDBCStoreManager)store).getCacheMapFromQuerySQLCache(
-                RelationFieldStrategy.class);
+            if (relationFieldUnionCache == null) {
+                relationFieldUnionCache =
+                    ((JDBCStoreManager) store)
+                        .getCacheMapFromQuerySQLCache(RelationFieldStrategy.class);
+            }
             boolean found = true;
             JDBCFetchConfiguration fetchClone = new JDBCFetchConfigurationImpl();
             fetchClone.copy(fetch);



Mime
View raw message