[mapguide-commits] r6814 - in branches/2.4/MgDev/Desktop: MgDesktop MgDesktop/Services MgDesktop/Services/Feature UnitTest

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue Jun 26 04:39:15 PDT 2012


Author: jng
Date: 2012-06-26 04:39:14 -0700 (Tue, 26 Jun 2012)
New Revision: 6814

Modified:
   branches/2.4/MgDev/Desktop/MgDesktop/MgDesktop.h
   branches/2.4/MgDev/Desktop/MgDesktop/Services/Feature/FdoConnectionPool.cpp
   branches/2.4/MgDev/Desktop/MgDesktop/Services/Feature/FeatureConnection.cpp
   branches/2.4/MgDev/Desktop/MgDesktop/Services/FeatureService.cpp
   branches/2.4/MgDev/Desktop/UnitTest/TestLogManager.h
Log:
mg-desktop updates:
 - Fix incorrect connection pooling behaviour. Pooled connections should never be closed when returned back to the pool. They should be closed only on PurgeCache() or the MgFdoConnectionPool destructor. This is why raster-based providers were failing to render because closing them wiped their loaded configuration documents, causing rendering and stylization to be done against what is essentially barebone un-configured feature sources.
 - Disable some occasionally-failing logging tests which have no use in a mg-desktop context
 - Fix an incorrect catch macro in MgdFeatureService

Modified: branches/2.4/MgDev/Desktop/MgDesktop/MgDesktop.h
===================================================================
--- branches/2.4/MgDev/Desktop/MgDesktop/MgDesktop.h	2012-06-25 16:44:12 UTC (rev 6813)
+++ branches/2.4/MgDev/Desktop/MgDesktop/MgDesktop.h	2012-06-26 11:39:14 UTC (rev 6814)
@@ -87,6 +87,7 @@
 
 //Uncomment to get extra FDO join chatter when running unit tests
 //#define DEBUG_FDOJOIN
+//Uncomment to get extra connection pool chatter
 //#define DEBUG_FDO_CONNECTION_POOL
 
 #endif
\ No newline at end of file

Modified: branches/2.4/MgDev/Desktop/MgDesktop/Services/Feature/FdoConnectionPool.cpp
===================================================================
--- branches/2.4/MgDev/Desktop/MgDesktop/Services/Feature/FdoConnectionPool.cpp	2012-06-25 16:44:12 UTC (rev 6813)
+++ branches/2.4/MgDev/Desktop/MgDesktop/Services/Feature/FdoConnectionPool.cpp	2012-06-26 11:39:14 UTC (rev 6814)
@@ -55,6 +55,7 @@
     #ifdef DEBUG_FDO_CONNECTION_POOL
         ACE_DEBUG((LM_INFO, ACE_TEXT("[Created]: (%W)\n"), featureSourceId->ToString().c_str()));
     #endif
+        conn->Open();
         return conn.Detach();
     }
     else
@@ -66,6 +67,8 @@
         #ifdef DEBUG_FDO_CONNECTION_POOL
             ACE_DEBUG((LM_INFO, ACE_TEXT("[Re-used]: (%W) %d in cache\n"), featureSourceId->ToString().c_str(), it->second.size()));
         #endif
+            if (FdoConnectionState_Closed == rec._conn->GetConnectionState())
+                rec._conn->Open();
             return rec._conn;
         }
         else
@@ -77,6 +80,7 @@
         #ifdef DEBUG_FDO_CONNECTION_POOL
             ACE_DEBUG((LM_INFO, ACE_TEXT("[Created]: (%W)\n"), featureSourceId->ToString().c_str()));
         #endif
+            conn->Open();
             return conn.Detach();
         }
     }
@@ -87,12 +91,12 @@
 void MgFdoConnectionPool::ReturnConnection(MgFeatureConnection* conn)
 {
     ScopedLock scc(g_pool.mutex);
+    STRING providerName = conn->GetProviderName();
     FdoPtr<FdoIConnection> fdoConn = conn->GetConnection();
     Ptr<MgResourceIdentifier> fsId = conn->GetFeatureSource();
     STRING fsIdStr = fsId->ToString();
-    fdoConn->Close();
 
-    //Only return it to pool if pooling enabled
+    //Only return it to pool if pooling enabled. Connections returned to the pool stay open otherwise close them
     if (g_bPoolingEnabled)
     {
         STRING providerName = MgFdoConnectionUtil::ParseNonQualifiedProviderName(conn->GetProviderName());
@@ -106,11 +110,19 @@
         }
         else
         {
+            fdoConn->Close();
         #ifdef DEBUG_FDO_CONNECTION_POOL
-            ACE_DEBUG((LM_INFO, ACE_TEXT("Connection (%W) is not poolable\n"), fsIdStr.c_str()));
+            ACE_DEBUG((LM_INFO, ACE_TEXT("[Closed] (%W) - Provider excluded from pooling\n"), fsIdStr.c_str()));
         #endif
         }
     }
+    else
+    {
+        fdoConn->Close();
+        #ifdef DEBUG_FDO_CONNECTION_POOL
+            ACE_DEBUG((LM_INFO, ACE_TEXT("[Closed] (%W) - Connection Pooling disabled\n"), fsIdStr.c_str()));
+        #endif
+    }
 }
 
 void MgFdoConnectionPool::Initialize(MgConfiguration* pConfiguration)

Modified: branches/2.4/MgDev/Desktop/MgDesktop/Services/Feature/FeatureConnection.cpp
===================================================================
--- branches/2.4/MgDev/Desktop/MgDesktop/Services/Feature/FeatureConnection.cpp	2012-06-25 16:44:12 UTC (rev 6813)
+++ branches/2.4/MgDev/Desktop/MgDesktop/Services/Feature/FeatureConnection.cpp	2012-06-26 11:39:14 UTC (rev 6814)
@@ -9,10 +9,9 @@
 #ifdef DEBUG_FDO_CONNECTION_POOL
     ACE_DEBUG((LM_INFO, ACE_TEXT("MgFeatureConnection::MgFeatureConnection(MgResourceIdentifier*)\n")));
 #endif
-    //This is a poolable connection
+    //This is a potentially poolable connection
     m_fdoConn = MgFdoConnectionPool::GetConnection(featureSourceIdentifier);
     CHECKNULL(m_fdoConn, L"MgFeatureConnection.MgFeatureConnection()");
-    m_fdoConn->Open();
 
     m_resourceId = SAFE_ADDREF(featureSourceIdentifier);
     m_bIsCreatedFromFeatureSource = true;

Modified: branches/2.4/MgDev/Desktop/MgDesktop/Services/FeatureService.cpp
===================================================================
--- branches/2.4/MgDev/Desktop/MgDesktop/Services/FeatureService.cpp	2012-06-25 16:44:12 UTC (rev 6813)
+++ branches/2.4/MgDev/Desktop/MgDesktop/Services/FeatureService.cpp	2012-06-26 11:39:14 UTC (rev 6814)
@@ -5789,7 +5789,7 @@
 
     clone = MgFeatureUtil::CloneMgClassDefinition(classDefinition);
 
-    MG_FEATURE_SERVICE_CATCH_AND_THROW(L"MgdFeatureService::GetClassDefinition", resource)
+    MG_FEATURE_SERVICE_CATCH_AND_THROW_WITH_FEATURE_SOURCE(L"MgdFeatureService::GetClassDefinition", resource)
 
     return clone.Detach();
 }

Modified: branches/2.4/MgDev/Desktop/UnitTest/TestLogManager.h
===================================================================
--- branches/2.4/MgDev/Desktop/UnitTest/TestLogManager.h	2012-06-25 16:44:12 UTC (rev 6813)
+++ branches/2.4/MgDev/Desktop/UnitTest/TestLogManager.h	2012-06-26 11:39:14 UTC (rev 6814)
@@ -69,8 +69,8 @@
     CPPUNIT_TEST(TestCase_GetTraceLogInvalid);
 
     CPPUNIT_TEST(TestCase_LogAccessEntry);
-    CPPUNIT_TEST(TestCase_LogAdminEntry);
-    CPPUNIT_TEST(TestCase_LogAuthenticationEntry);
+    //CPPUNIT_TEST(TestCase_LogAdminEntry);             //Not applicable for mg-desktop
+    //CPPUNIT_TEST(TestCase_LogAuthenticationEntry);    //Not applicable for mg-desktop
     CPPUNIT_TEST(TestCase_LogErrorEntry);
     CPPUNIT_TEST(TestCase_LogTraceEntry);
 



More information about the mapguide-commits mailing list