[mapguide-commits] r6757 - in branches/2.4/MgDev: . Common/Stylization Server/src/Common/Manager Server/src/Services/Feature Server/src/Services/Mapping Web/src/mapadmin/HelpDocs Web/src/mapviewerphp Web/src/viewerfiles
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Wed Jun 13 06:07:42 PDT 2012
Author: jng
Date: 2012-06-13 06:07:42 -0700 (Wed, 13 Jun 2012)
New Revision: 6757
Modified:
branches/2.4/MgDev/
branches/2.4/MgDev/Common/Stylization/SE_Renderer.cpp
branches/2.4/MgDev/Server/src/Common/Manager/FdoConnectionManager.cpp
branches/2.4/MgDev/Server/src/Common/Manager/FdoConnectionManager.h
branches/2.4/MgDev/Server/src/Services/Feature/ServerFeatureUtil.cpp
branches/2.4/MgDev/Server/src/Services/Mapping/MappingUtil.cpp
branches/2.4/MgDev/Web/src/mapadmin/HelpDocs/
branches/2.4/MgDev/Web/src/mapadmin/HelpDocs/configuring_servers.htm
branches/2.4/MgDev/Web/src/mapviewerphp/quickplotgeneratepicture.php
branches/2.4/MgDev/Web/src/viewerfiles/
branches/2.4/MgDev/Web/src/viewerfiles/quickplot.js
Log:
#1998: Merge trunk connection manager enhancements to 2.4 branch
Property changes on: branches/2.4/MgDev
___________________________________________________________________
Modified: svn:mergeinfo
- /sandbox/rfc94:5099-5163
/trunk/MgDev:6611
+ /sandbox/rfc94:5099-5163
/trunk/MgDev:6611,6690,6746
Property changes on: branches/2.4/MgDev/Common/Stylization/SE_Renderer.cpp
___________________________________________________________________
Modified: svn:mergeinfo
- /sandbox/adsk/2.4j/Common/Stylization/SE_Renderer.cpp:6327-6445
/sandbox/rfc94/Common/Stylization/SE_Renderer.cpp:5099-5163
/trunk/MgDev/Common/Stylization/SE_Renderer.cpp:6250-6326,6611
+ /sandbox/adsk/2.4j/Common/Stylization/SE_Renderer.cpp:6327-6445
/sandbox/rfc94/Common/Stylization/SE_Renderer.cpp:5099-5163
/trunk/MgDev/Common/Stylization/SE_Renderer.cpp:6250-6326,6611,6690,6746
Modified: branches/2.4/MgDev/Server/src/Common/Manager/FdoConnectionManager.cpp
===================================================================
--- branches/2.4/MgDev/Server/src/Common/Manager/FdoConnectionManager.cpp 2012-06-13 08:57:02 UTC (rev 6756)
+++ branches/2.4/MgDev/Server/src/Common/Manager/FdoConnectionManager.cpp 2012-06-13 13:07:42 UTC (rev 6757)
@@ -239,26 +239,38 @@
// Try to acquire a connection. We will either get a connection or exhaust the re-try logic
providerInfo = TryAcquireFdoConnection(provider);
+
+ bool reuseOnly = false;
+
+ ACE_MT(ACE_GUARD_RETURN(ACE_Recursive_Thread_Mutex, ace_mon, sm_mutex, NULL));
if(providerInfo)
{
- ACE_MT(ACE_GUARD_RETURN(ACE_Recursive_Thread_Mutex, ace_mon, sm_mutex, NULL));
+ // If current connections count is equal to the pool size of the provider, we cannot create new connection.
+ // But if it is a PerCommandThreaded/MultiThreaded provider, we can reuse existing connections.
+ reuseOnly = (providerInfo->GetCurrentConnections() == providerInfo->GetPoolSize() &&
+ ((providerInfo->GetThreadModel() == FdoThreadCapability_PerCommandThreaded) ||
+ (providerInfo->GetThreadModel() == FdoThreadCapability_MultiThreaded)));
if(m_bFdoConnectionPoolEnabled)
{
// Search the cache for an FDO connection matching this resourceIdentifier
// The content and long transaction name must also match, as the information may change
- pFdoConnection = FindFdoConnection(resourceIdentifier);
+ pFdoConnection = FindFdoConnection(resourceIdentifier, reuseOnly);
}
+ }
+
+ if (providerInfo && ((NULL == pFdoConnection && !reuseOnly) || (NULL != pFdoConnection)))
+ {
+ STRING longTransactionName = (STRING)featureSource->GetLongTransaction();
+ // Update the long transaction name to any active one for the current request
+ MgLongTransactionManager::GetLongTransactionName(resourceIdentifier, longTransactionName);
+
if(NULL == pFdoConnection)
{
// Parse XML and get properties
STRING configDocumentName = (STRING)featureSource->GetConfigurationDocument();
- STRING longTransactionName = (STRING)featureSource->GetLongTransaction();
- // Update the long transaction name to any active one for the current request
- MgLongTransactionManager::GetLongTransactionName(resourceIdentifier, longTransactionName);
-
// Create a new connection
pFdoConnection = m_connManager->CreateConnection(provider.c_str());
@@ -294,6 +306,11 @@
resourceIdentifier->ToString(),
longTransactionName);
}
+ else
+ {
+ // Need to activate long transaction again for some providers.
+ ActivateLongTransaction(pFdoConnection, longTransactionName);
+ }
#ifdef _DEBUG_FDOCONNECTION_MANAGER
ShowProviderInfoCache();
@@ -394,16 +411,26 @@
// Try to acquire a connection. We will either get a connection or exhaust the re-try logic
providerInfo = TryAcquireFdoConnection(providerNoVersion);
+
+ bool reuseOnly = false;
+
if(providerInfo)
{
- ACE_MT(ACE_GUARD_RETURN(ACE_Recursive_Thread_Mutex, ace_mon, sm_mutex, NULL));
+ // If current connections count is equal to the pool size of the provider, we cannot create new connection.
+ // But if it is a PerCommandThreaded/MultiThreaded provider, we can reuse existing connections.
+ reuseOnly = (providerInfo->GetCurrentConnections() == providerInfo->GetPoolSize() &&
+ ((providerInfo->GetThreadModel() == FdoThreadCapability_PerCommandThreaded) ||
+ (providerInfo->GetThreadModel() == FdoThreadCapability_MultiThreaded)));
if(m_bFdoConnectionPoolEnabled)
{
// Search the cache for an FDO connection matching this provider/connection string
- pFdoConnection = FindFdoConnection(providerNoVersion, updatedConnectionString);
+ pFdoConnection = FindFdoConnection(providerNoVersion, updatedConnectionString, reuseOnly);
}
+ }
+ if (providerInfo && ((NULL == pFdoConnection && !reuseOnly) || (NULL != pFdoConnection)))
+ {
if(NULL == pFdoConnection)
{
// Create a new connection and add it to the cache
@@ -611,7 +638,7 @@
}
-FdoIConnection* MgFdoConnectionManager::FindFdoConnection(MgResourceIdentifier* resourceIdentifier)
+FdoIConnection* MgFdoConnectionManager::FindFdoConnection(MgResourceIdentifier* resourceIdentifier, bool reuseOnly)
{
CHECKNULL(resourceIdentifier, L"MgFdoConnectionManager.FindFdoConnection");
@@ -644,7 +671,8 @@
pFdoConnection = SearchFdoConnectionCache(provider,
resourceIdentifier->ToString(),
- ltName);
+ ltName,
+ reuseOnly);
MG_FDOCONNECTION_MANAGER_CATCH_AND_THROW_WITH_FEATURE_SOURCE(L"MgFdoConnectionManager.FindFdoConnection", resourceIdentifier)
@@ -652,7 +680,7 @@
}
-FdoIConnection* MgFdoConnectionManager::FindFdoConnection(CREFSTRING provider, CREFSTRING connectionString)
+FdoIConnection* MgFdoConnectionManager::FindFdoConnection(CREFSTRING provider, CREFSTRING connectionString, bool reuseOnly)
{
FdoPtr<FdoIConnection> pFdoConnection;
@@ -661,7 +689,7 @@
STRING providerNoVersion = UpdateProviderName(provider);
STRING ltName = L"";
- pFdoConnection = SearchFdoConnectionCache(providerNoVersion, connectionString, ltName);
+ pFdoConnection = SearchFdoConnectionCache(providerNoVersion, connectionString, ltName, reuseOnly);
MG_FDOCONNECTION_MANAGER_CATCH_AND_THROW(L"MgFdoConnectionManager.FindFdoConnection")
@@ -669,7 +697,7 @@
}
-FdoIConnection* MgFdoConnectionManager::SearchFdoConnectionCache(CREFSTRING provider, CREFSTRING key, CREFSTRING ltName)
+FdoIConnection* MgFdoConnectionManager::SearchFdoConnectionCache(CREFSTRING provider, CREFSTRING key, CREFSTRING ltName, bool reuseOnly)
{
FdoPtr<FdoIConnection> pFdoConnection;
@@ -709,9 +737,12 @@
INT32 useLimit = providerInfo->GetUseLimit();
if (useLimit == -1 || pFdoConnectionCacheEntry->nUseTotal <= useLimit)
{
+ // If the provider is a PerCommandThreaded/MultiThreaded provider, reuse existing
+ // connection only when reuseOnly is true (current connections count == pool size).
if((!pFdoConnectionCacheEntry->bInUse) ||
- (providerInfo->GetThreadModel() == FdoThreadCapability_PerCommandThreaded) ||
- (providerInfo->GetThreadModel() == FdoThreadCapability_MultiThreaded))
+ (reuseOnly &&
+ ((providerInfo->GetThreadModel() == FdoThreadCapability_PerCommandThreaded) ||
+ (providerInfo->GetThreadModel() == FdoThreadCapability_MultiThreaded))))
{
// It is not in use or the provider is a PerCommandThreaded/MultiThreaded provider so claim it
pFdoConnectionCacheEntry->lastUsed = ACE_OS::gettimeofday();
@@ -1430,7 +1461,10 @@
if(providerInfo)
{
// Check to see if all connections are in use
- if(providerInfo->GetCurrentConnections() == providerInfo->GetPoolSize())
+ // If it is a PerCommandThreaded/MultiThreaded provider, the existing connections can be reused.
+ if(providerInfo->GetCurrentConnections() == providerInfo->GetPoolSize() &&
+ ((providerInfo->GetThreadModel() != FdoThreadCapability_PerCommandThreaded) &&
+ (providerInfo->GetThreadModel() != FdoThreadCapability_MultiThreaded)))
{
// All connections are in use
providerInfo = NULL;
Modified: branches/2.4/MgDev/Server/src/Common/Manager/FdoConnectionManager.h
===================================================================
--- branches/2.4/MgDev/Server/src/Common/Manager/FdoConnectionManager.h 2012-06-13 08:57:02 UTC (rev 6756)
+++ branches/2.4/MgDev/Server/src/Common/Manager/FdoConnectionManager.h 2012-06-13 13:07:42 UTC (rev 6757)
@@ -247,9 +247,9 @@
// Constructor
MgFdoConnectionManager();
- FdoIConnection* FindFdoConnection(MgResourceIdentifier* resourceIdentifier);
- FdoIConnection* FindFdoConnection(CREFSTRING provider, CREFSTRING connectionString);
- FdoIConnection* SearchFdoConnectionCache(CREFSTRING provider, CREFSTRING key, CREFSTRING ltName);
+ FdoIConnection* FindFdoConnection(MgResourceIdentifier* resourceIdentifier, bool reuseOnly = false);
+ FdoIConnection* FindFdoConnection(CREFSTRING provider, CREFSTRING connectionString, bool reuseOnly = false);
+ FdoIConnection* SearchFdoConnectionCache(CREFSTRING provider, CREFSTRING key, CREFSTRING ltName, bool reuseOnly = false);
void CacheFdoConnection(FdoIConnection* pFdoConnection, CREFSTRING provider, CREFSTRING key, CREFSTRING ltName);
bool UpdateFdoConnectionCache(CREFSTRING provider);
Property changes on: branches/2.4/MgDev/Server/src/Services/Feature/ServerFeatureUtil.cpp
___________________________________________________________________
Modified: svn:mergeinfo
- /sandbox/adsk/2.4j/Server/src/Services/Feature/ServerFeatureUtil.cpp:6327-6481
/sandbox/rfc94/Server/src/Services/Feature/ServerFeatureUtil.cpp:5099-5163
/trunk/MgDev/Server/src/Services/Feature/ServerFeatureUtil.cpp:6250-6326,6611
+ /sandbox/adsk/2.4j/Server/src/Services/Feature/ServerFeatureUtil.cpp:6327-6481
/sandbox/rfc94/Server/src/Services/Feature/ServerFeatureUtil.cpp:5099-5163
/trunk/MgDev/Server/src/Services/Feature/ServerFeatureUtil.cpp:6250-6326,6611,6690,6746
Property changes on: branches/2.4/MgDev/Server/src/Services/Mapping/MappingUtil.cpp
___________________________________________________________________
Modified: svn:mergeinfo
- /sandbox/adsk/2.4j/Server/src/Services/Mapping/MappingUtil.cpp:6327-6535
/sandbox/rfc94/Server/src/Services/Mapping/MappingUtil.cpp:5099-5163
/trunk/MgDev/Server/src/Services/Mapping/MappingUtil.cpp:6250-6326,6611
+ /sandbox/adsk/2.4j/Server/src/Services/Mapping/MappingUtil.cpp:6327-6535
/sandbox/rfc94/Server/src/Services/Mapping/MappingUtil.cpp:5099-5163
/trunk/MgDev/Server/src/Services/Mapping/MappingUtil.cpp:6250-6326,6611,6690,6746
Property changes on: branches/2.4/MgDev/Web/src/mapadmin/HelpDocs
___________________________________________________________________
Modified: svn:mergeinfo
- /sandbox/adsk/2.4j/Web/src/mapadmin/HelpDocs:6413
/sandbox/rfc94/Web/src/mapadmin/HelpDocs:5099-5163
/trunk/MgDev/Web/src/mapadmin/HelpDocs:6611
+ /sandbox/adsk/2.4j/Web/src/mapadmin/HelpDocs:6413
/sandbox/rfc94/Web/src/mapadmin/HelpDocs:5099-5163
/trunk/MgDev/Web/src/mapadmin/HelpDocs:6611,6690,6746
Property changes on: branches/2.4/MgDev/Web/src/mapadmin/HelpDocs/configuring_servers.htm
___________________________________________________________________
Modified: svn:mergeinfo
- /sandbox/adsk/2.4j/Web/src/mapadmin/HelpDocs/configuring_servers.htm:6327-6435
/sandbox/rfc94/Web/src/mapadmin/HelpDocs/configuring_servers.htm:5099-5163
/trunk/MgDev/Web/src/mapadmin/HelpDocs/configuring_servers.htm:6250-6326,6611
+ /sandbox/adsk/2.4j/Web/src/mapadmin/HelpDocs/configuring_servers.htm:6327-6435
/sandbox/rfc94/Web/src/mapadmin/HelpDocs/configuring_servers.htm:5099-5163
/trunk/MgDev/Web/src/mapadmin/HelpDocs/configuring_servers.htm:6250-6326,6611,6690,6746
Property changes on: branches/2.4/MgDev/Web/src/mapviewerphp/quickplotgeneratepicture.php
___________________________________________________________________
Modified: svn:mergeinfo
- /sandbox/adsk/2.4jbeta2/Web/src/mapviewerphp/quickplotgeneratepicture.php:6334-6374
/sandbox/rfc94/Web/src/mapviewerphp/quickplotgeneratepicture.php:5099-5163
/trunk/MgDev/Web/src/mapviewerphp/quickplotgeneratepicture.php:6611
+ /sandbox/adsk/2.4jbeta2/Web/src/mapviewerphp/quickplotgeneratepicture.php:6334-6374
/sandbox/rfc94/Web/src/mapviewerphp/quickplotgeneratepicture.php:5099-5163
/trunk/MgDev/Web/src/mapviewerphp/quickplotgeneratepicture.php:6611,6690,6746
Property changes on: branches/2.4/MgDev/Web/src/viewerfiles
___________________________________________________________________
Modified: svn:mergeinfo
- /sandbox/adsk/2.2gp/Web/src/viewerfiles:5392
/trunk/MgDev/Web/src/viewerfiles:6611
+ /sandbox/adsk/2.2gp/Web/src/viewerfiles:5392
/trunk/MgDev/Web/src/viewerfiles:6611,6690,6746
Property changes on: branches/2.4/MgDev/Web/src/viewerfiles/quickplot.js
___________________________________________________________________
Modified: svn:mergeinfo
- /sandbox/adsk/2.2gp/Web/src/viewerfiles/quickplot.js:5392
/sandbox/adsk/2.4j/Web/src/viewerfiles/quickplot.js:6327-6474
/trunk/MgDev/Web/src/viewerfiles/quickplot.js:6250-6326,6611
+ /sandbox/adsk/2.2gp/Web/src/viewerfiles/quickplot.js:5392
/sandbox/adsk/2.4j/Web/src/viewerfiles/quickplot.js:6327-6474
/trunk/MgDev/Web/src/viewerfiles/quickplot.js:6250-6326,6611,6690,6746
More information about the mapguide-commits
mailing list