cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mgen...@apache.org
Subject svn commit: r608235 - /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataContext.java
Date Wed, 02 Jan 2008 21:26:16 GMT
Author: mgentry
Date: Wed Jan  2 13:26:15 2008
New Revision: 608235

URL: http://svn.apache.org/viewvc?rev=608235&view=rev
Log:
Removed double-checked locking of queryCache.  See http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html
for details.

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataContext.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataContext.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataContext.java?rev=608235&r1=608234&r2=608235&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataContext.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataContext.java
Wed Jan  2 13:26:15 2008
@@ -257,16 +257,11 @@
      * 
      * @since 3.0
      */
-    public QueryCache getQueryCache() {
-
+    public synchronized QueryCache getQueryCache() {
         if (queryCache == null) {
-            synchronized (this) {
-                if (queryCache == null) {
-                    queryCache = getParentDataDomain()
-                            .getQueryCacheFactory()
-                            .getQueryCache(Collections.EMPTY_MAP);
-                }
-            }
+            queryCache = getParentDataDomain()
+                    .getQueryCacheFactory()
+                    .getQueryCache(Collections.EMPTY_MAP);
         }
 
         return queryCache;
@@ -277,7 +272,7 @@
      * 
      * @since 3.0
      */
-    public void setQueryCache(QueryCache queryCache) {
+    public synchronized void setQueryCache(QueryCache queryCache) {
         this.queryCache = queryCache;
     }
 



Mime
View raw message