[mapguide-commits] r4329 - sandbox/adsk/2.1/Common/MapGuideCommon/Services

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue Nov 3 14:03:27 EST 2009


Author: brucedechant
Date: 2009-11-03 14:03:27 -0500 (Tue, 03 Nov 2009)
New Revision: 4329

Modified:
   sandbox/adsk/2.1/Common/MapGuideCommon/Services/SiteManager.cpp
Log:
Fix for trac ticket 1131 - Load balancing doesn't support failover
http://trac.osgeo.org/mapguide/ticket/1131

Notes:
- Update failover retry time when a site contains only a single server
- Update MgUserInformation as the GetSiteStatus doesn't require authentication


Modified: sandbox/adsk/2.1/Common/MapGuideCommon/Services/SiteManager.cpp
===================================================================
--- sandbox/adsk/2.1/Common/MapGuideCommon/Services/SiteManager.cpp	2009-11-01 23:24:51 UTC (rev 4328)
+++ sandbox/adsk/2.1/Common/MapGuideCommon/Services/SiteManager.cpp	2009-11-03 19:03:27 UTC (rev 4329)
@@ -31,6 +31,8 @@
     bool bDone = false;
     while(!bDone)
     {
+        INT32 sleepTime = threadData->failoverRetryTime;
+
         MgSiteVector* sites = siteManager->GetSites();
         if(sites)
         {
@@ -45,7 +47,7 @@
                     MG_TRY()
 
                     // Send a simple request to the server to see if it can respond
-                    Ptr<MgUserInformation> userInformation = new MgUserInformation(L"Administrator", L"admin");
+                    Ptr<MgUserInformation> userInformation = new MgUserInformation(L"", L"");
                     Ptr<MgConnectionProperties> connProp = siteManager->GetConnectionProperties(userInformation, siteInfo, MgSiteInfo::Admin);
 
                     // Use GetSiteStatus because it doesn't require authentication
@@ -80,10 +82,23 @@
                     }
                 }
             }
+
+            // Does this site only contain 1 server?
+            if(sites->size() == 1)
+            {
+                MgSiteInfo* siteInfo = sites->at(0);
+
+                // Check the server status in case it was just updated
+                if (MgSiteInfo::Ok != siteInfo->GetStatus())
+                {
+                    // There is only 1 server in the site and it is not in a "Good" state yet so reduce the sleep time
+                    sleepTime = 1;
+                }
+            }
         }
 
         // Sleep the thread as thread resume/suspend is not supported on all platforms
-        ACE_OS::sleep(threadData->failoverRetryTime);
+        ACE_OS::sleep(sleepTime);
 
         // Update whether we are done or not
         bDone = siteManager->GetCheckServersThreadDone();



More information about the mapguide-commits mailing list