[mapguide-commits] r6407 - in sandbox/adsk/2.3r/Server/src: Common/Manager Core

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Jan 5 03:00:17 EST 2012


Author: christinebao
Date: 2012-01-05 00:00:17 -0800 (Thu, 05 Jan 2012)
New Revision: 6407

Modified:
   sandbox/adsk/2.3r/Server/src/Common/Manager/FdoConnectionManager.cpp
   sandbox/adsk/2.3r/Server/src/Core/serverconfig.ini
Log:
http://trac.osgeo.org/mapguide/ticket/1793
AIMS hang when foreign WMS is not available anymore
Integrate r6095, r6110, r6140 to Reeses SP2.

Modified: sandbox/adsk/2.3r/Server/src/Common/Manager/FdoConnectionManager.cpp
===================================================================
--- sandbox/adsk/2.3r/Server/src/Common/Manager/FdoConnectionManager.cpp	2012-01-05 05:22:18 UTC (rev 6406)
+++ sandbox/adsk/2.3r/Server/src/Common/Manager/FdoConnectionManager.cpp	2012-01-05 08:00:17 UTC (rev 6407)
@@ -262,6 +262,9 @@
             // Create a new connection
             pFdoConnection = m_connManager->CreateConnection(provider.c_str());
 
+            // Check if the connection support timeout setting
+            SetConnectionTimeout(pFdoConnection, provider);
+
             // Check if we have thread model
             if((FdoThreadCapability)-1 == providerInfo->GetThreadModel())
             {
@@ -381,6 +384,9 @@
             // Create a new connection and add it to the cache
             pFdoConnection = m_connManager->CreateConnection(providerNoVersion.c_str());
 
+            // Check if the connection support timeout setting
+            SetConnectionTimeout(pFdoConnection, providerNoVersion);
+
             // Check if we have thread model
             if((FdoThreadCapability)-1 == providerInfo->GetThreadModel())
             {
@@ -778,6 +784,54 @@
         }
 }
 
+void MgFdoConnectionManager::SetConnectionTimeout(FdoIConnection* pFdoConnection, STRING providerName)
+{
+    FdoPtr<FdoIConnectionCapabilities> connectionCapabilities = pFdoConnection->GetConnectionCapabilities();
+    if(connectionCapabilities->SupportsTimeout())
+    {
+        MgConfiguration* configuration = MgConfiguration::GetInstance();
+        ACE_ASSERT(NULL != configuration);
+        STRING timeoutCustom = MgConfigProperties::DefaultFeatureServicePropertyFDOConnectionTimeoutCustom;
+        if (NULL != configuration)
+        {
+            configuration->GetStringValue(
+                MgConfigProperties::FeatureServicePropertiesSection,
+                MgConfigProperties::FeatureServicePropertyFDOConnectionTimeoutCustom,
+                timeoutCustom,
+                MgConfigProperties::DefaultFeatureServicePropertyFDOConnectionTimeoutCustom);
+        }
+        if(timeoutCustom.length() > 0)
+        {
+            Ptr<MgStringCollection> fdoTimeoutCol = MgStringCollection::ParseCollection(timeoutCustom, L",");  // NOXLATE
+            // Update the fdo connection timeout value
+            if (fdoTimeoutCol.p)
+            {
+                for(INT32 i=0;i<fdoTimeoutCol->GetCount();i++)
+                {
+                    STRING fdoTimeoutCustom = fdoTimeoutCol->GetItem(i);
+                    STRING provider = L"";  // NOXLATE
+                    INT32 timeoutVal = 120;
+                    // Parse the format: provider:timeoutVal
+                    // Example: OSGeo.WMS:120
+                    Ptr<MgStringCollection> customCol = MgStringCollection::ParseCollection(fdoTimeoutCustom, L":");  // NOXLATE
+                    if(customCol->GetCount() == 2)
+                    {
+                        provider = customCol->GetItem(0);
+                        STRING value = customCol->GetItem(1);
+                        timeoutVal = MgUtil::StringToInt32(value);
+                    }                    
+                    if(provider.find(providerName) != STRING::npos && timeoutVal > 0)
+                    {
+                        //FDOConnectionTimeoutCustom is second, and FdoConnectionTimeout is millisecond.
+                        pFdoConnection->SetConnectionTimeout(timeoutVal * 1000);
+                        break;
+                    }
+                }
+            }
+        }
+    }
+}
+
 void MgFdoConnectionManager::ActivateSpatialContext(FdoIConnection* pFdoConnection, STRING& spatialContextName)
 {
     CHECKNULL((FdoIConnection*)pFdoConnection, L"MgFdoConnectionManager.ActivateSpatialContext()");

Modified: sandbox/adsk/2.3r/Server/src/Core/serverconfig.ini
===================================================================
--- sandbox/adsk/2.3r/Server/src/Core/serverconfig.ini	2012-01-05 05:22:18 UTC (rev 6406)
+++ sandbox/adsk/2.3r/Server/src/Core/serverconfig.ini	2012-01-05 08:00:17 UTC (rev 6407)
@@ -264,6 +264,8 @@
 # DataTransactionTimerInterval  Time interval in seconds for when the server
 #                                  checks for idle FDO transactions
 #                                       0 < Value <= 1800
+# FDOConnectionTimeoutCustom    Time duration in seconds for an FDO connection
+#                                       0 < Value <= 600
 # *****************************************************************************
 CacheSize                          = 100
 CacheTimeLimit                     = 86400
@@ -278,6 +280,7 @@
 JoinQueryBatchSize                 = 1000
 DataTransactionTimeout             = 360
 DataTransactionTimerInterval       = 60
+FDOConnectionTimeoutCustom         = OSGeo.WMS:120
 
 [MappingServiceProperties]
 # *****************************************************************************



More information about the mapguide-commits mailing list