[ 
https://issues.apache.org/jira/browse/CAY-1880?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13812973#comment-13812973
 ] 

Mike Kienenberger commented on CAY-1880:
----------------------------------------

 The problem appears to be in DataDomainQueryAction.interceptRefreshQuery().  
If there's a domain.getSharedSnapshotCache(), we clear it for refresh-all, or 
send notification events, but we do nothing if there is no shared snapshot 
cache.

What needs to happen is that the context's objectstore should be appropriately 
adjusted when there's no shared snapshot cache.

The following patch makes this change and passes all tests.

Index: 
framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataDomainQueryAction.java
===================================================================
--- 
framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataDomainQueryAction.java
     (revision 1524993)
+++ 
framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataDomainQueryAction.java
     (working copy)
@@ -272,6 +272,9 @@
                 // not sending any events - peer contexts will not get 
refreshed
                 if (domain.getSharedSnapshotCache() != null) {
                     domain.getSharedSnapshotCache().clear();
+                } else {
+                    // remove snapshots from local ObjectStore only
+                    context.getObjectStore().getDataRowCache().clear();
                 }
                 context.getQueryCache().clear();
 
@@ -298,6 +301,14 @@
                             Collections.EMPTY_LIST,
                             ids,
                             Collections.EMPTY_LIST);
+                } else {
+                    // remove snapshots from local ObjectStore only
+                    
context.getObjectStore().getDataRowCache().processSnapshotChanges(
+                            context.getObjectStore(),
+                            Collections.EMPTY_MAP,
+                            Collections.EMPTY_LIST,
+                            ids,
+                            Collections.EMPTY_LIST);
                 }
 
                 GenericResponse response = new GenericResponse();


> objectStore snapshots never cleared from RefreshQuery when "use shared cache" 
> unchecked
> ---------------------------------------------------------------------------------------
>
>                 Key: CAY-1880
>                 URL: https://issues.apache.org/jira/browse/CAY-1880
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Core Library
>    Affects Versions: 3.1B2
>            Reporter: Mike Kienenberger
>            Assignee: Mike Kienenberger
>
> When unchecking the "use shared cache" option or setting 
> dataDomain.setSharedCacheEnabled(false); in java code, RefreshQueries do 
> remove snapshots from the local context's objectStore's dataRowCache.
> See the following threads for more information.
> http://mail-archives.apache.org/mod_mbox/cayenne-user/201309.mbox/%3CCAM1yOjbJSWpAVJOF%3DDHMt0iLQ1_UCtF-Yk%3D9fMY7ivd5-hwT0Q%40mail.gmail.com%3E
> http://mail-archives.apache.org/mod_mbox/cayenne-user/201311.mbox/%3C9C1A94FD-DA3B-4B35-8A9E-0C8E74FA3D68%40objectstyle.org%3E



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to