[mapguide-commits] r4330 - trunk/MgDev/Server/src/Common/Manager
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Thu Nov 5 14:59:41 EST 2009
Author: brucedechant
Date: 2009-11-05 14:59:40 -0500 (Thu, 05 Nov 2009)
New Revision: 4330
Modified:
trunk/MgDev/Server/src/Common/Manager/FdoConnectionManager.cpp
trunk/MgDev/Server/src/Common/Manager/FdoConnectionManager.h
Log:
Fix for trac ticket 1140 - Add better support for PerCommandThreaded/MultiThreaded FDO providers
http://trac.osgeo.org/mapguide/ticket/1140
Notes:
- Added a check for PerCommandThreaded/MultiThreaded FDO provider capability
- Allow FDO connections to be reused if the underlying FDO provider supports PerCommandThreaded/MultiThreaded
Modified: trunk/MgDev/Server/src/Common/Manager/FdoConnectionManager.cpp
===================================================================
--- trunk/MgDev/Server/src/Common/Manager/FdoConnectionManager.cpp 2009-11-03 19:03:27 UTC (rev 4329)
+++ trunk/MgDev/Server/src/Common/Manager/FdoConnectionManager.cpp 2009-11-05 19:59:40 UTC (rev 4330)
@@ -604,11 +604,14 @@
if(pFdoConnectionCacheEntry->ltName == ltName)
{
// We have a long transaction name match
- if(!pFdoConnectionCacheEntry->bInUse)
+ if((!pFdoConnectionCacheEntry->bInUse) ||
+ (providerInfo->GetThreadModel() == FdoThreadCapability_PerCommandThreaded) ||
+ (providerInfo->GetThreadModel() == FdoThreadCapability_MultiThreaded))
{
- // It is not in use so claim it
+ // It is not in use or the provider is a PerCommandThreaded/MultiThreaded provider so claim it
pFdoConnectionCacheEntry->lastUsed = ACE_OS::gettimeofday();
pFdoConnectionCacheEntry->bInUse = true;
+ pFdoConnectionCacheEntry->nUseCount++; // Only used by PerCommandThreaded/MultiThreaded
// Check to see if the key is blank which indicates a blank connection string was cached
if(0 < key.size())
@@ -1089,6 +1092,7 @@
pFdoConnectionCacheEntry->lastUsed = ACE_OS::gettimeofday();
pFdoConnectionCacheEntry->bValid = true;
pFdoConnectionCacheEntry->bInUse = true;
+ pFdoConnectionCacheEntry->nUseCount = 1;
#ifdef _DEBUG_FDOCONNECTION_MANAGER
ACE_DEBUG ((LM_DEBUG, ACE_TEXT("CacheFdoConnection:\nConnection: %@\nProvider = %W\nKey = %W\nVersion(LT) = %W\n\n"), (void*)pFdoConnection, provider.c_str(), key.c_str(), ltName.empty() ? L"(empty)" : ltName.c_str()));
@@ -1571,8 +1575,15 @@
// Are we supposed to release this provider from the cache?
if ((providerInfo->GetKeepCached()) && (pFdoConnectionCacheEntry->bValid))
{
- // Make the connection available
- pFdoConnectionCacheEntry->bInUse = false;
+ // Try to make the connection available
+ pFdoConnectionCacheEntry->nUseCount--;
+
+ // If the provider was PerCommandThreaded/MultiThreaded the connection may still be in use
+ if(0 >= pFdoConnectionCacheEntry->nUseCount)
+ {
+ pFdoConnectionCacheEntry->bInUse = false;
+ pFdoConnectionCacheEntry->nUseCount = 0;
+ }
}
else
{
@@ -1901,6 +1912,11 @@
info += (pFdoConnectionCacheEntry->bInUse) ? L"True" : L"False";
info += L"</InUse>\n";
+ info += L"<UseCount>";
+ ACE_OS::itoa(pFdoConnectionCacheEntry->nUseCount, buffer, 10);
+ info += buffer;
+ info += L"</UseCount>\n";
+
info += L"<LongTransaction>";
info += pFdoConnectionCacheEntry->ltName;
info += L"</LongTransaction>\n";
Modified: trunk/MgDev/Server/src/Common/Manager/FdoConnectionManager.h
===================================================================
--- trunk/MgDev/Server/src/Common/Manager/FdoConnectionManager.h 2009-11-03 19:03:27 UTC (rev 4329)
+++ trunk/MgDev/Server/src/Common/Manager/FdoConnectionManager.h 2009-11-05 19:59:40 UTC (rev 4330)
@@ -41,6 +41,7 @@
ACE_Time_Value lastUsed;
bool bValid;
bool bInUse;
+ INT32 nUseCount; // Used by PerCommandThreaded/MultiThreaded providers
} FdoConnectionCacheEntry;
// FDO Connection Cache
More information about the mapguide-commits
mailing list