[mapguide-commits] r7531 - in branches/2.5/MgDev/Desktop: MgDesktop/Services UnitTest

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue May 28 06:26:13 PDT 2013


Author: jng
Date: 2013-05-28 06:26:12 -0700 (Tue, 28 May 2013)
New Revision: 7531

Modified:
   branches/2.5/MgDev/Desktop/MgDesktop/Services/ResourceService.cpp
   branches/2.5/MgDev/Desktop/UnitTest/TestResourceService.cpp
Log:
#2279: Fix a content caching bug with SetResource() not flushing out any in-memory cached content. We fix this by moving cached content clearance to our ReleasePotentialLocks() hook function.

Also fix premature cache clearance on TestCase_BenchmarkGetResourceContents()

Modified: branches/2.5/MgDev/Desktop/MgDesktop/Services/ResourceService.cpp
===================================================================
--- branches/2.5/MgDev/Desktop/MgDesktop/Services/ResourceService.cpp	2013-05-27 15:51:29 UTC (rev 7530)
+++ branches/2.5/MgDev/Desktop/MgDesktop/Services/ResourceService.cpp	2013-05-28 13:26:12 UTC (rev 7531)
@@ -451,10 +451,6 @@
     {
         ReleasePotentialLocks(resource);
 
-        //Empty cached version
-        MgdResourceContentCache* cache = MgdResourceContentCache::GetInstance();
-        cache->RemoveContentEntry(resource);
-
         STRING contentPath = ResolveContentPath(resource);
 	    STRING dataPath = ResolveDataPath(resource);
 	    if (MgFileUtil::IsFile(contentPath))
@@ -494,6 +490,10 @@
 
 void MgdResourceService::ReleasePotentialLocks(MgResourceIdentifier* resource)
 {
+    //Empty cached version
+    MgdResourceContentCache* cache = MgdResourceContentCache::GetInstance();
+    cache->RemoveContentEntry(resource);
+
     CHECKARGUMENTNULL(resource, L"MgdResourceService::DeleteResource");
     if (resource->GetResourceType() == MgResourceType::FeatureSource)
     {

Modified: branches/2.5/MgDev/Desktop/UnitTest/TestResourceService.cpp
===================================================================
--- branches/2.5/MgDev/Desktop/UnitTest/TestResourceService.cpp	2013-05-27 15:51:29 UTC (rev 7530)
+++ branches/2.5/MgDev/Desktop/UnitTest/TestResourceService.cpp	2013-05-28 13:26:12 UTC (rev 7531)
@@ -1153,11 +1153,11 @@
 			Ptr<MgByteReader> content = pService->GetResourceContent(resId);
 		}
 		ACE_DEBUG((LM_INFO, ACE_TEXT("  Execution Time: = %6.4f (s)\n"), ((GetTickCount()-lStart)/1000.0) ));
-		
-		//Evict all cached copies to avoid distortion of results due to caching
-		cache->Clear();
 		ACE_DEBUG((LM_INFO, ACE_TEXT(" %d resource content items in cache\n"), (cache->GetCacheSize()) ));
 
+        //Evict all cached copies to avoid distortion of results due to caching
+        cache->Clear();
+
 		lStart = GetTickCount();
 		Ptr<MgStringCollection> contents;
 		ACE_DEBUG((LM_INFO, ACE_TEXT("\nTestResourceService::TestCase_BenchmarkGetResourceContents() - Multi-threaded GetResourceContents call (cold) \n")));



More information about the mapguide-commits mailing list