[mapguide-commits] r6095 - in trunk/MgDev: Common/MapGuideCommon/System Server/src/Common/Manager Server/src/Core

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Thu Aug 25 03:43:11 EDT 2011


Author: christinebao
Date: 2011-08-25 00:43:11 -0700 (Thu, 25 Aug 2011)
New Revision: 6095

Modified:
   trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp
   trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.h
   trunk/MgDev/Server/src/Common/Manager/FdoConnectionManager.cpp
   trunk/MgDev/Server/src/Common/Manager/FdoConnectionManager.h
   trunk/MgDev/Server/src/Core/serverconfig.ini
Log:
Fix ticket http://trac.osgeo.org/mapguide/ticket/1793
AIMS hang when foreign WMS is not available anymore

Modified: trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp	2011-08-25 07:16:21 UTC (rev 6094)
+++ trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.cpp	2011-08-25 07:43:11 UTC (rev 6095)
@@ -274,6 +274,8 @@
 const INT32  MgConfigProperties::DefaultFeatureServicePropertyDataTransactionTimeout        = 360;
 const STRING MgConfigProperties::FeatureServicePropertyDataTransactionTimerInterval         = L"DataTransactionTimerInterval";
 const INT32  MgConfigProperties::DefaultFeatureServicePropertyDataTransactionTimerInterval  = 60;
+const STRING MgConfigProperties::FeatureServicePropertyFDOConnectionTimeout                 = L"FDOConnectionTimeout";
+const INT32  MgConfigProperties::DefaultFeatureServicePropertyFDOConnectionTimeout          = 120;
 
 // ******************************************************************
 // Mapping Service Properties
@@ -647,6 +649,7 @@
     { MgConfigProperties::FeatureServicePropertyDataConnectionUseLimit              , MgPropertyType::String    , MG_CONFIG_MIN_FS_CP_EXCLUDED_LENGTH   , MG_CONFIG_MAX_FS_CP_EXCLUDED_LENGTH   , L""                                       },
     { MgConfigProperties::FeatureServicePropertyDataTransactionTimeout              , MgPropertyType::Int32     , MG_CONFIG_MIN_TIMEOUT                 , MG_CONFIG_MAX_TIMEOUT                 , L""                                       },
     { MgConfigProperties::FeatureServicePropertyDataTransactionTimerInterval        , MgPropertyType::Int32     , MG_CONFIG_MIN_TIMER_INTERVAL          , MG_CONFIG_MAX_TIMER_INTERVAL          , L""                                       },
+    { MgConfigProperties::FeatureServicePropertyFDOConnectionTimeout                , MgPropertyType::Int32     , 1                                     , 600                                   , L""                                       },
     { L""                                                                           , 0                         , 0.0                                   , 0.0                                   , L""                                       }
 };
 

Modified: trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.h
===================================================================
--- trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.h	2011-08-25 07:16:21 UTC (rev 6094)
+++ trunk/MgDev/Common/MapGuideCommon/System/ConfigProperties.h	2011-08-25 07:43:11 UTC (rev 6095)
@@ -339,6 +339,10 @@
     static const STRING FeatureServicePropertyDataTransactionTimerInterval;      /// value("DataTransactionTimerInterval")
     static const INT32 DefaultFeatureServicePropertyDataTransactionTimerInterval;/// value(60)
 
+    /// Set the time duration in seconds for an FDO connection
+    static const STRING FeatureServicePropertyFDOConnectionTimeout;              /// value("FDOConnectionTimeout")
+    static const INT32 DefaultFeatureServicePropertyFDOConnectionTimeout;        /// value(120)
+
     /// MAPPING SERVICE PROPERTIES SECTION -------------------------------------------------------------------------------
 
     /// Mapping Service properties

Modified: trunk/MgDev/Server/src/Common/Manager/FdoConnectionManager.cpp
===================================================================
--- trunk/MgDev/Server/src/Common/Manager/FdoConnectionManager.cpp	2011-08-25 07:16:21 UTC (rev 6094)
+++ trunk/MgDev/Server/src/Common/Manager/FdoConnectionManager.cpp	2011-08-25 07:43:11 UTC (rev 6095)
@@ -262,6 +262,9 @@
             // Create a new connection
             pFdoConnection = m_connManager->CreateConnection(provider.c_str());
 
+            // Check if the connection support timeout setting
+            SetConnectionTimeout(pFdoConnection);
+
             // 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);
+
             // Check if we have thread model
             if((FdoThreadCapability)-1 == providerInfo->GetThreadModel())
             {
@@ -779,6 +785,29 @@
         }
 }
 
+void MgFdoConnectionManager::SetConnectionTimeout(FdoIConnection* pFdoConnection)
+{
+    FdoPtr<FdoIConnectionCapabilities> connectionCapabilities = pFdoConnection->GetConnectionCapabilities();
+    if(connectionCapabilities->SupportsTimeout())
+    {
+        MgConfiguration* configuration = MgConfiguration::GetInstance();
+        ACE_ASSERT(NULL != configuration);
+        INT32 timeout = MgConfigProperties::DefaultFeatureServicePropertyFDOConnectionTimeout;
+        if (NULL != configuration)
+        {
+            configuration->GetIntValue(
+                MgConfigProperties::FeatureServicePropertiesSection,
+                MgConfigProperties::FeatureServicePropertyFDOConnectionTimeout,
+                timeout,
+                MgConfigProperties::DefaultFeatureServicePropertyFDOConnectionTimeout);
+        }
+        if(timeout > 0)
+        {
+            pFdoConnection->SetConnectionTimeout(timeout);
+        }
+    }
+}
+
 void MgFdoConnectionManager::ActivateSpatialContext(FdoIConnection* pFdoConnection, STRING& spatialContextName)
 {
     CHECKNULL((FdoIConnection*)pFdoConnection, L"MgFdoConnectionManager.ActivateSpatialContext()");

Modified: trunk/MgDev/Server/src/Common/Manager/FdoConnectionManager.h
===================================================================
--- trunk/MgDev/Server/src/Common/Manager/FdoConnectionManager.h	2011-08-25 07:16:21 UTC (rev 6094)
+++ trunk/MgDev/Server/src/Common/Manager/FdoConnectionManager.h	2011-08-25 07:43:11 UTC (rev 6095)
@@ -253,6 +253,8 @@
     void SetConfiguration(CREFSTRING provider, FdoIConnection* pFdoConnection, MgResourceIdentifier* resourceIdentifier, STRING& configDataName);
     void SetConnectionProperties(FdoIConnection* pFdoConnection, MdfModel::FeatureSource* pFeatureSource);
 
+    void SetConnectionTimeout(FdoIConnection* pFdoConnection);
+
     void ActivateSpatialContext(FdoIConnection* pFdoConnection, STRING& spatialContextName);
     void ActivateLongTransaction(FdoIConnection* pFdoConnection, STRING& longTransactionName);
     bool SupportsConfiguration(FdoIConnection* pFdoConnection);

Modified: trunk/MgDev/Server/src/Core/serverconfig.ini
===================================================================
--- trunk/MgDev/Server/src/Core/serverconfig.ini	2011-08-25 07:16:21 UTC (rev 6094)
+++ trunk/MgDev/Server/src/Core/serverconfig.ini	2011-08-25 07:43:11 UTC (rev 6095)
@@ -1,4 +1,4 @@
-# *****************************************************************************
+# *****************************************************************************
 # MapGuide Server Configuration File
 #
 # The following configuration is based on a single CPU with a single core.
@@ -264,6 +264,8 @@
 # DataTransactionTimerInterval  Time interval in seconds for when the server
 #                                  checks for idle FDO transactions
 #                                       0 < Value <= 1800
+# FDOConnectionTimeout             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
+FDOConnectionTimeout               = 120
 
 [MappingServiceProperties]
 # *****************************************************************************



More information about the mapguide-commits mailing list