[mapguide-commits] r8785 - in sandbox/adsk/2.6l/Server/src: Common/Cache Common/Manager Services/Feature Services/Mapping Services/Rendering
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Sun Oct 18 21:16:56 PDT 2015
Author: hubu
Date: 2015-10-18 21:16:56 -0700 (Sun, 18 Oct 2015)
New Revision: 8785
Added:
sandbox/adsk/2.6l/Server/src/Common/Cache/ResourceLayerDefinitionCacheItem.cpp
sandbox/adsk/2.6l/Server/src/Common/Cache/ResourceLayerDefinitionCacheItem.h
sandbox/adsk/2.6l/Server/src/Common/Cache/ResourceServiceCache.cpp
sandbox/adsk/2.6l/Server/src/Common/Cache/ResourceServiceCache.h
sandbox/adsk/2.6l/Server/src/Common/Cache/ResourceServiceCacheEntry.cpp
sandbox/adsk/2.6l/Server/src/Common/Cache/ResourceServiceCacheEntry.h
Modified:
sandbox/adsk/2.6l/Server/src/Common/Cache/ServerCache.vcxproj
sandbox/adsk/2.6l/Server/src/Common/Cache/ServerCacheBuild.cpp
sandbox/adsk/2.6l/Server/src/Common/Manager/CacheManager.cpp
sandbox/adsk/2.6l/Server/src/Common/Manager/CacheManager.h
sandbox/adsk/2.6l/Server/src/Common/Manager/FdoConnectionManager.cpp
sandbox/adsk/2.6l/Server/src/Services/Feature/ServerDescribeSchema.cpp
sandbox/adsk/2.6l/Server/src/Services/Mapping/MappingUtil.cpp
sandbox/adsk/2.6l/Server/src/Services/Mapping/ServerMappingService.vcxproj
sandbox/adsk/2.6l/Server/src/Services/Rendering/ServerRenderingService.cpp
sandbox/adsk/2.6l/Server/src/Services/Rendering/ServerRenderingService.vcxproj
Log:
Merge part of RFC 151 to sandbox/autodesk/2.6l
We merge part of RFC 151 to autodesk/2.6l branch to create a performance hot fix for one AIMS customer. The integration includes majar part of the implementation on MgDev branch. What are NOT included are: 1) configuration changes. In 2.6, we will reuse the configuration of Feature Service Cache for Resource Service Cache. 2) resource service cache timeout handler. Because the handler is in ServerCore project. If we add the handler, the EXE file will be changed. It is not suitable for a hot fix. 3) Linux build change. It will be submitted later.
I also made a change in FDOConnectionMangager. The customer is using Autodesk.Oracle provider. He encountered a special issue that a query to "all_dependencies" bursted when server was under heavy load. It is because the 'describe schema' command is only executed on the first connection. The rest new connections have NO schema info. So it has to execute a query to "all_dependencies" to get the class info. So I added some hack code. For Autodesk.Oracle provider, we execute a 'Describe Schema' command after a new connection is opened. The workaround is tested by customer. It solved the "all_dependencies" query burst issue.
Added: sandbox/adsk/2.6l/Server/src/Common/Cache/ResourceLayerDefinitionCacheItem.cpp
===================================================================
--- sandbox/adsk/2.6l/Server/src/Common/Cache/ResourceLayerDefinitionCacheItem.cpp (rev 0)
+++ sandbox/adsk/2.6l/Server/src/Common/Cache/ResourceLayerDefinitionCacheItem.cpp 2015-10-19 04:16:56 UTC (rev 8785)
@@ -0,0 +1,53 @@
+//
+// Copyright (C) 2004-2015 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#include "MapGuideCommon.h"
+#include "ResourceLayerDefinitionCacheItem.h"
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief
+/// Construct the object.
+///
+MgResourceLayerDefinitionCacheItem::MgResourceLayerDefinitionCacheItem()
+{
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief
+/// Construct the object.
+///
+MgResourceLayerDefinitionCacheItem::MgResourceLayerDefinitionCacheItem(MdfModel::LayerDefinition* layerDefinition)
+{
+ Set(layerDefinition);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief
+/// Destruct the object.
+///
+MgResourceLayerDefinitionCacheItem::~MgResourceLayerDefinitionCacheItem()
+{
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief
+/// Set the layer definition.
+///
+void MgResourceLayerDefinitionCacheItem::Set(MdfModel::LayerDefinition* layerDefinition)
+{
+ m_layerDefinition.reset(layerDefinition);
+}
Added: sandbox/adsk/2.6l/Server/src/Common/Cache/ResourceLayerDefinitionCacheItem.h
===================================================================
--- sandbox/adsk/2.6l/Server/src/Common/Cache/ResourceLayerDefinitionCacheItem.h (rev 0)
+++ sandbox/adsk/2.6l/Server/src/Common/Cache/ResourceLayerDefinitionCacheItem.h 2015-10-19 04:16:56 UTC (rev 8785)
@@ -0,0 +1,63 @@
+//
+// Copyright (C) 2004-2015 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifndef MG_RESOURCE_LAYER_DEFINITION_CACHE_ITEM_H_
+#define MG_RESOURCE_LAYER_DEFINITION_CACHE_ITEM_H_
+
+#include "ServerCacheItem.h"
+#include "LayerDefinition.h"
+#include <memory>
+
+using namespace std;
+
+class MG_SERVER_CACHE_API MgResourceLayerDefinitionCacheItem : public MgServerCacheItem
+{
+/// Constructors/Destructor
+
+public:
+ MgResourceLayerDefinitionCacheItem(void);
+ explicit MgResourceLayerDefinitionCacheItem(MdfModel::LayerDefinition* LayerDefinition);
+ virtual ~MgResourceLayerDefinitionCacheItem(void);
+
+private:
+
+ // Unimplemented copy constructor and assignment operator.
+ MgResourceLayerDefinitionCacheItem(const MgResourceLayerDefinitionCacheItem&);
+ MgResourceLayerDefinitionCacheItem& operator=(const MgResourceLayerDefinitionCacheItem&);
+
+/// Methods
+
+public:
+
+ MdfModel::LayerDefinition* Get();
+ void Set(MdfModel::LayerDefinition* layerDefinition);
+
+/// Data Members
+
+private:
+
+ auto_ptr<MdfModel::LayerDefinition> m_layerDefinition;
+};
+
+/// Inline Methods
+
+inline MdfModel::LayerDefinition* MgResourceLayerDefinitionCacheItem::Get()
+{
+ return m_layerDefinition.get();
+}
+
+#endif
Added: sandbox/adsk/2.6l/Server/src/Common/Cache/ResourceServiceCache.cpp
===================================================================
--- sandbox/adsk/2.6l/Server/src/Common/Cache/ResourceServiceCache.cpp (rev 0)
+++ sandbox/adsk/2.6l/Server/src/Common/Cache/ResourceServiceCache.cpp 2015-10-19 04:16:56 UTC (rev 8785)
@@ -0,0 +1,315 @@
+//
+// Copyright (C) 2004-2015 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#include "MapGuideCommon.h"
+#include "ResourceServiceCache.h"
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief
+/// Construct the object.
+///
+MgResourceServiceCache::MgResourceServiceCache() :
+ m_nDroppedEntries(0)
+{
+ //Initialize(MgConfigProperties::DefaultFeatureServicePropertyCacheSize,
+ // MgConfigProperties::DefaultFeatureServicePropertyCacheTimeLimit);
+ Initialize(4000, 86400);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief
+/// Destruct the object.
+///
+MgResourceServiceCache::~MgResourceServiceCache()
+{
+ MG_TRY()
+
+ ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%t) MgResourceServiceCache::~MgResourceServiceCache()\n")));
+
+ Clear();
+
+ MG_CATCH_AND_RELEASE()
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief
+/// Clear the cache.
+///
+void MgResourceServiceCache::Clear()
+{
+ ACE_MT(ACE_GUARD(ACE_Recursive_Thread_Mutex, ace_mon, m_mutex));
+
+ for (MgResourceServiceCacheEntries::iterator i = m_resourceServiceCacheEntries.begin();
+ i != m_resourceServiceCacheEntries.end(); ++i)
+ {
+#ifdef _DEBUG
+ ACE_ASSERT(NULL != i->second);
+
+ if (NULL != i->second && 1 != i->second->GetRefCount())
+ {
+ ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%t) MgResourceServiceCache::Clear() - Reference Count of '%W': %d\n"),
+ i->first.c_str(), i->second->GetRefCount()));
+ }
+#endif
+ SAFE_RELEASE(i->second);
+ }
+
+ m_resourceServiceCacheEntries.clear();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief
+/// Compact the cache.
+///
+void MgResourceServiceCache::Compact()
+{
+ ACE_MT(ACE_GUARD(ACE_Recursive_Thread_Mutex, ace_mon, m_mutex));
+
+ INT32 size = (INT32)m_resourceServiceCacheEntries.size();
+
+ if (size >= m_size)
+ {
+ RemoveOldEntry();
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief
+/// Return an existing entry from this cache or a newly created one
+/// if it does not exist.
+///
+MgResourceServiceCacheEntry* MgResourceServiceCache::SetEntry(MgResourceIdentifier* resource)
+{
+ ACE_MT(ACE_GUARD_RETURN(ACE_Recursive_Thread_Mutex, ace_mon, m_mutex, NULL));
+
+ Ptr<MgResourceServiceCacheEntry> entry = GetEntry(resource);
+
+ if (NULL == entry.p)
+ {
+ Compact();
+
+ entry = new MgResourceServiceCacheEntry();
+ m_resourceServiceCacheEntries.insert(MgResourceServiceCacheEntries::value_type(
+ resource->ToString(), SAFE_ADDREF(entry.p)));
+ }
+
+ return entry.Detach();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief
+/// Return an existing entry from this cache.
+///
+MgResourceServiceCacheEntry* MgResourceServiceCache::GetEntry(MgResourceIdentifier* resource)
+{
+ if (NULL == resource)
+ {
+ throw new MgNullArgumentException(
+ L"MgResourceServiceCache.GetEntry",
+ __LINE__, __WFILE__, NULL, L"", NULL);
+ }
+
+ resource->Validate();
+
+ if (!resource->IsResourceTypeOf(MgResourceType::LayerDefinition))
+ {
+ throw new MgInvalidResourceTypeException(
+ L"MgResourceServiceCache.GetEntry",
+ __LINE__, __WFILE__, NULL, L"", NULL);
+ }
+
+ ACE_MT(ACE_GUARD_RETURN(ACE_Recursive_Thread_Mutex, ace_mon, m_mutex, NULL));
+
+ Ptr<MgResourceServiceCacheEntry> entry;
+ MgResourceServiceCacheEntries::iterator i =
+ m_resourceServiceCacheEntries.find(resource->ToString());
+
+ if (m_resourceServiceCacheEntries.end() != i)
+ {
+ entry = SAFE_ADDREF(i->second);
+ entry->UpdateTimestamp();
+ }
+
+ return entry.Detach();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief
+/// Remove an entry from the cache.
+///
+void MgResourceServiceCache::RemoveEntry(CREFSTRING resource)
+{
+ ACE_MT(ACE_GUARD(ACE_Recursive_Thread_Mutex, ace_mon, m_mutex));
+
+ MgResourceServiceCacheEntries::iterator i =
+ m_resourceServiceCacheEntries.find(resource);
+
+ if (m_resourceServiceCacheEntries.end() != i)
+ {
+ SAFE_RELEASE(i->second);
+ m_resourceServiceCacheEntries.erase(i);
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief
+/// Remove an entry from the cache.
+///
+void MgResourceServiceCache::RemoveEntry(MgResourceIdentifier* resource)
+{
+ if (NULL != resource)
+ {
+ RemoveEntry(resource->ToString());
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief
+/// Remove the first oldest entry from the cache.
+///
+void MgResourceServiceCache::RemoveOldEntry()
+{
+ ACE_MT(ACE_GUARD(ACE_Recursive_Thread_Mutex, ace_mon, m_mutex));
+
+ MgResourceServiceCacheEntries::iterator currIter, prevIter, oldEntry;
+
+ currIter = prevIter = oldEntry = m_resourceServiceCacheEntries.begin();
+
+ while (m_resourceServiceCacheEntries.end() != currIter)
+ {
+ if (NULL == currIter->second)
+ {
+ oldEntry = currIter;
+ break;
+ }
+
+ if (currIter->second->GetTimestamp() < oldEntry->second->GetTimestamp())
+ {
+ oldEntry = currIter;
+ }
+
+ if (currIter->second->GetTimestamp() < prevIter->second->GetTimestamp())
+ {
+ break;
+ }
+ else
+ {
+ prevIter = currIter;
+ }
+
+ ++currIter;
+ }
+
+ if (m_resourceServiceCacheEntries.end() != oldEntry)
+ {
+ SAFE_RELEASE(oldEntry->second);
+ m_resourceServiceCacheEntries.erase(oldEntry);
+ m_nDroppedEntries++;
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief
+/// Remove expired entries from the cache.
+///
+void MgResourceServiceCache::RemoveExpiredEntries()
+{
+ ACE_MT(ACE_GUARD(ACE_Recursive_Thread_Mutex, ace_mon, m_mutex));
+
+ ACE_Time_Value currTime = ACE_High_Res_Timer::gettimeofday();
+ MgResourceServiceCacheEntries::iterator i = m_resourceServiceCacheEntries.begin();
+
+ while (m_resourceServiceCacheEntries.end() != i)
+ {
+ if (NULL == i->second)
+ {
+ m_resourceServiceCacheEntries.erase(i++);
+ }
+ else
+ {
+ ACE_Time_Value idleTimeout = currTime - i->second->GetTimestamp();
+
+ if (idleTimeout > m_timeLimit) // entry has been expired
+ {
+ SAFE_RELEASE(i->second);
+ m_resourceServiceCacheEntries.erase(i++);
+ }
+ else
+ {
+ ++i;
+ }
+ }
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief
+/// Methods to manage cache entries.
+///
+void MgResourceServiceCache::SetLayerDefinition(MgResourceIdentifier* resource, MgResourceLayerDefinitionCacheItem* layerDefinition)
+{
+ ACE_MT(ACE_GUARD(ACE_Recursive_Thread_Mutex, ace_mon, m_mutex));
+
+ Ptr<MgResourceServiceCacheEntry> entry = SetEntry(resource);
+
+ entry->SetLayerDefinition(layerDefinition);
+}
+
+MgResourceLayerDefinitionCacheItem* MgResourceServiceCache::GetLayerDefinition(MgResourceIdentifier* resource)
+{
+ ACE_MT(ACE_GUARD_RETURN(ACE_Recursive_Thread_Mutex, ace_mon, m_mutex, NULL));
+
+ Ptr<MgResourceLayerDefinitionCacheItem> data;
+ Ptr<MgResourceServiceCacheEntry> entry = GetEntry(resource);
+
+ if (NULL != entry.p)
+ {
+ data = entry->GetLayerDefinition();
+
+ // Make sure this cached data is only used by one thread at a time.
+ if (NULL != data.p && data->GetRefCount() > 2)
+ {
+ data = NULL;
+ }
+ }
+
+ return data.Detach();
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief
+/// Returns the size of the cache.
+///
+INT32 MgResourceServiceCache::GetCacheSize()
+{
+ ACE_MT(ACE_GUARD_RETURN(ACE_Recursive_Thread_Mutex, ace_mon, m_mutex, -1));
+
+ INT32 size = (INT32)m_resourceServiceCacheEntries.size();
+ return size;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief
+/// Returns the # of dropped cache entries.
+///
+INT32 MgResourceServiceCache::GetDroppedEntriesCount()
+{
+ ACE_MT(ACE_GUARD_RETURN(ACE_Recursive_Thread_Mutex, ace_mon, m_mutex, -1));
+
+ return m_nDroppedEntries;
+}
+
Added: sandbox/adsk/2.6l/Server/src/Common/Cache/ResourceServiceCache.h
===================================================================
--- sandbox/adsk/2.6l/Server/src/Common/Cache/ResourceServiceCache.h (rev 0)
+++ sandbox/adsk/2.6l/Server/src/Common/Cache/ResourceServiceCache.h 2015-10-19 04:16:56 UTC (rev 8785)
@@ -0,0 +1,75 @@
+//
+// Copyright (C) 2004-2015 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifndef MG_RESOURCE_SERVICE_CACHE_H_
+#define MG_RESOURCE_SERVICE_CACHE_H_
+
+#include "ServerCache.h"
+#include "ResourceServiceCacheEntry.h"
+
+class MG_SERVER_CACHE_API MgResourceServiceCache : public MgServerCache
+{
+ DECLARE_CLASSNAME(MgResourceServiceCache)
+
+/// Constructors/Destructor
+
+public:
+ MgResourceServiceCache(void);
+ ~MgResourceServiceCache(void);
+
+private:
+
+ // Unimplemented copy constructor and assignment operator.
+ MgResourceServiceCache(const MgResourceServiceCache&);
+ MgResourceServiceCache& operator=(const MgResourceServiceCache&);
+
+/// Methods
+
+public:
+
+ virtual void Clear();
+
+ void RemoveEntry(CREFSTRING resource);
+ void RemoveEntry(MgResourceIdentifier* resource);
+ void RemoveExpiredEntries();
+
+ void SetLayerDefinition(MgResourceIdentifier* resource, MgResourceLayerDefinitionCacheItem* layerDefinition);
+ MgResourceLayerDefinitionCacheItem* GetLayerDefinition(MgResourceIdentifier* source);
+
+ INT32 GetCacheSize();
+ INT32 GetDroppedEntriesCount();
+
+protected:
+
+ void Compact();
+
+ MgResourceServiceCacheEntry* SetEntry(MgResourceIdentifier* resource);
+ MgResourceServiceCacheEntry* GetEntry(MgResourceIdentifier* resource);
+ void RemoveOldEntry();
+
+/// Data Members
+
+private:
+
+ friend class MgCacheManager;
+
+ typedef std::map<STRING, MgResourceServiceCacheEntry*> MgResourceServiceCacheEntries;
+ MgResourceServiceCacheEntries m_resourceServiceCacheEntries;
+ INT32 m_nDroppedEntries;
+};
+
+#endif
Added: sandbox/adsk/2.6l/Server/src/Common/Cache/ResourceServiceCacheEntry.cpp
===================================================================
--- sandbox/adsk/2.6l/Server/src/Common/Cache/ResourceServiceCacheEntry.cpp (rev 0)
+++ sandbox/adsk/2.6l/Server/src/Common/Cache/ResourceServiceCacheEntry.cpp 2015-10-19 04:16:56 UTC (rev 8785)
@@ -0,0 +1,53 @@
+//
+// Copyright (C) 2004-2015 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#include "MapGuideCommon.h"
+#include "ResourceServiceCacheEntry.h"
+
+#include <set>
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief
+/// Construct the object.
+///
+MgResourceServiceCacheEntry::MgResourceServiceCacheEntry()
+{
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief
+/// Destruct the object.
+///
+MgResourceServiceCacheEntry::~MgResourceServiceCacheEntry()
+{
+
+}
+
+///////////////////////////////////////////////////////////////////////////////
+/// \brief
+/// Methods to manage cache items.
+///
+void MgResourceServiceCacheEntry::SetLayerDefinition(MgResourceLayerDefinitionCacheItem* layerDefinition)
+{
+ m_layerDefinition = SAFE_ADDREF(layerDefinition);
+}
+
+MgResourceLayerDefinitionCacheItem* MgResourceServiceCacheEntry::GetLayerDefinition()
+{
+ return SAFE_ADDREF(m_layerDefinition.p);
+}
+
Added: sandbox/adsk/2.6l/Server/src/Common/Cache/ResourceServiceCacheEntry.h
===================================================================
--- sandbox/adsk/2.6l/Server/src/Common/Cache/ResourceServiceCacheEntry.h (rev 0)
+++ sandbox/adsk/2.6l/Server/src/Common/Cache/ResourceServiceCacheEntry.h 2015-10-19 04:16:56 UTC (rev 8785)
@@ -0,0 +1,47 @@
+//
+// Copyright (C) 2004-2015 by Autodesk, Inc.
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of version 2.1 of the GNU Lesser
+// General Public License as published by the Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+//
+
+#ifndef MG_RESOURCE_SERVICE_CACHE_ENTRY_H_
+#define MG_RESOURCE_SERVICE_CACHE_ENTRY_H_
+
+#include "ServerCacheEntry.h"
+#include "ResourceLayerDefinitionCacheItem.h"
+
+class MG_SERVER_CACHE_API MgResourceServiceCacheEntry : public MgServerCacheEntry
+{
+/// Constructors/Destructor
+public:
+ MgResourceServiceCacheEntry(void);
+ virtual ~MgResourceServiceCacheEntry(void);
+
+private:
+
+ // Unimplemented copy constructor and assignment operator.
+ MgResourceServiceCacheEntry(const MgResourceServiceCacheEntry&);
+ MgResourceServiceCacheEntry& operator=(const MgResourceServiceCacheEntry&);
+
+/// Methods
+
+public:
+ void SetLayerDefinition(MgResourceLayerDefinitionCacheItem* layerDefinition);
+ MgResourceLayerDefinitionCacheItem* GetLayerDefinition();
+
+private:
+ Ptr<MgResourceLayerDefinitionCacheItem> m_layerDefinition;
+};
+
+#endif
Modified: sandbox/adsk/2.6l/Server/src/Common/Cache/ServerCache.vcxproj
===================================================================
--- sandbox/adsk/2.6l/Server/src/Common/Cache/ServerCache.vcxproj 2015-10-17 15:55:04 UTC (rev 8784)
+++ sandbox/adsk/2.6l/Server/src/Common/Cache/ServerCache.vcxproj 2015-10-19 04:16:56 UTC (rev 8785)
@@ -224,6 +224,24 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
+ <ClCompile Include="ResourceLayerDefinitionCacheItem.cpp">
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+ </ClCompile>
+ <ClCompile Include="ResourceServiceCache.cpp">
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+ </ClCompile>
+ <ClCompile Include="ResourceServiceCacheEntry.cpp">
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+ </ClCompile>
<ClCompile Include="ServerCache.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
@@ -256,6 +274,9 @@
<ClInclude Include="FeatureServiceCache.h" />
<ClInclude Include="FeatureServiceCacheEntry.h" />
<ClInclude Include="FeatureSourceCacheItem.h" />
+ <ClInclude Include="ResourceLayerDefinitionCacheItem.h" />
+ <ClInclude Include="ResourceServiceCache.h" />
+ <ClInclude Include="ResourceServiceCacheEntry.h" />
<ClInclude Include="ServerCache.h" />
<ClInclude Include="ServerCacheDllExport.h" />
<ClInclude Include="ServerCacheEntry.h" />
Modified: sandbox/adsk/2.6l/Server/src/Common/Cache/ServerCacheBuild.cpp
===================================================================
--- sandbox/adsk/2.6l/Server/src/Common/Cache/ServerCacheBuild.cpp 2015-10-17 15:55:04 UTC (rev 8784)
+++ sandbox/adsk/2.6l/Server/src/Common/Cache/ServerCacheBuild.cpp 2015-10-19 04:16:56 UTC (rev 8785)
@@ -24,3 +24,7 @@
#include "FeatureServiceCacheEntry.cpp"
#include "FeatureSourceCacheItem.cpp"
#include "SpatialContextCacheItem.cpp"
+#include "ResourceLayerDefinitionCacheItem.cpp"
+#include "ResourceServiceCache.cpp"
+#include "ResourceServiceCacheEntry.cpp"
+
Modified: sandbox/adsk/2.6l/Server/src/Common/Manager/CacheManager.cpp
===================================================================
--- sandbox/adsk/2.6l/Server/src/Common/Manager/CacheManager.cpp 2015-10-17 15:55:04 UTC (rev 8784)
+++ sandbox/adsk/2.6l/Server/src/Common/Manager/CacheManager.cpp 2015-10-19 04:16:56 UTC (rev 8785)
@@ -108,6 +108,9 @@
MgConfigProperties::DefaultFeatureServicePropertyCacheTimeLimit);
m_featureServiceCache.Initialize(cacheSize, cacheTimeLimit);
+
+ // Initialize resource service cache
+ m_resourceServiceCache.Initialize(cacheSize, cacheTimeLimit);
}
///////////////////////////////////////////////////////////////////////////////
@@ -121,9 +124,12 @@
ACE_MT(ACE_GUARD(ACE_Recursive_Thread_Mutex, ace_mon, m_fdoConnectionManager->sm_mutex));
{
ACE_MT(ACE_GUARD(ACE_Recursive_Thread_Mutex, ace_mon, m_featureServiceCache.m_mutex));
-
- m_fdoConnectionManager->ClearCache();
- m_featureServiceCache.Clear();
+ {
+ ACE_MT(ACE_GUARD(ACE_Recursive_Thread_Mutex, ace_mon, m_resourceServiceCache.m_mutex));
+ m_fdoConnectionManager->ClearCache();
+ m_featureServiceCache.Clear();
+ m_resourceServiceCache.Clear();
+ }
}
}
@@ -168,6 +174,11 @@
m_featureServiceCache.RemoveEntry(resource);
}
}
+ if (STRING::npos != resource.rfind(MgResourceType::LayerDefinition))
+ {
+ ACE_MT(ACE_GUARD(ACE_Recursive_Thread_Mutex, ace_mon, m_resourceServiceCache.m_mutex));
+ m_resourceServiceCache.RemoveEntry(resource);
+ }
}
///////////////////////////////////////////////////////////////////////////////
@@ -176,17 +187,25 @@
///
void MgCacheManager::NotifyResourceChanged(MgResourceIdentifier* resource)
{
- if (NULL != resource && resource->IsResourceTypeOf(MgResourceType::FeatureSource))
+ if (NULL != resource)
{
- // The mutex usage and the method call order here are important
- // because they ensure all the caches are in sync.
- ACE_MT(ACE_GUARD(ACE_Recursive_Thread_Mutex, ace_mon, m_fdoConnectionManager->sm_mutex));
+ if (resource->IsResourceTypeOf(MgResourceType::FeatureSource))
{
- ACE_MT(ACE_GUARD(ACE_Recursive_Thread_Mutex, ace_mon, m_featureServiceCache.m_mutex));
+ // The mutex usage and the method call order here are important
+ // because they ensure all the caches are in sync.
+ ACE_MT(ACE_GUARD(ACE_Recursive_Thread_Mutex, ace_mon, m_fdoConnectionManager->sm_mutex));
+ {
+ ACE_MT(ACE_GUARD(ACE_Recursive_Thread_Mutex, ace_mon, m_featureServiceCache.m_mutex));
- m_fdoConnectionManager->RemoveCachedFdoConnection(resource);
- m_featureServiceCache.RemoveEntry(resource);
+ m_fdoConnectionManager->RemoveCachedFdoConnection(resource);
+ m_featureServiceCache.RemoveEntry(resource);
+ }
}
+ else if (resource->IsResourceTypeOf(MgResourceType::LayerDefinition))
+ {
+ ACE_MT(ACE_GUARD(ACE_Recursive_Thread_Mutex, ace_mon, m_resourceServiceCache.m_mutex));
+ m_resourceServiceCache.RemoveEntry(resource);
+ }
}
}
@@ -367,3 +386,50 @@
return notificationNeeded;
}
+
+MgResourceLayerDefinitionCacheItem* MgCacheManager::GetResourceLayerDefinitionCacheItem(MgResourceIdentifier* resource)
+{
+ Ptr<MgResourceLayerDefinitionCacheItem> cacheItem;
+
+ MG_TRY()
+
+ ACE_MT(ACE_GUARD_RETURN(ACE_Recursive_Thread_Mutex, ace_mon, m_resourceServiceCache.m_mutex, NULL));
+ cacheItem = m_resourceServiceCache.GetLayerDefinition(resource);
+
+ if (NULL == cacheItem.p)
+ {
+ // Get the Resource Service.
+ Ptr<MgResourceService> resourceService = dynamic_cast<MgResourceService*>(
+ m_serviceManager->RequestService(MgServiceType::ResourceService));
+ ACE_ASSERT(NULL != resourceService.p);
+
+ auto_ptr<MdfModel::LayerDefinition> layerDefinition;
+ layerDefinition.reset(MgLayerBase::GetLayerDefinition(resourceService, resource));
+
+ if (NULL == layerDefinition.get())
+ {
+ MgResources* resources = MgResources::GetInstance();
+ ACE_ASSERT(NULL != resources);
+ STRING message = resources->GetResourceMessage(MgResources::FeatureService,
+ L"MgInvalidFdoProvider", NULL);
+ MgStringCollection arguments;
+ arguments.Add(message);
+
+ throw new MgInvalidFeatureSourceException(
+ L"MgCacheManager.GetResourceLayerDefinitionCacheItem",
+ __LINE__, __WFILE__, &arguments, L"", NULL);
+ }
+
+ cacheItem = new MgResourceLayerDefinitionCacheItem(layerDefinition.release());
+ m_resourceServiceCache.SetLayerDefinition(resource, cacheItem.p);
+ }
+ else
+ {
+ CheckPermission(resource, MgResourcePermission::ReadOnly);
+ }
+
+ MG_CATCH_AND_THROW(L"MgCacheManager.GetFeatureSourceCacheItem")
+
+ return cacheItem.Detach();
+}
+
Modified: sandbox/adsk/2.6l/Server/src/Common/Manager/CacheManager.h
===================================================================
--- sandbox/adsk/2.6l/Server/src/Common/Manager/CacheManager.h 2015-10-17 15:55:04 UTC (rev 8784)
+++ sandbox/adsk/2.6l/Server/src/Common/Manager/CacheManager.h 2015-10-19 04:16:56 UTC (rev 8785)
@@ -20,6 +20,7 @@
#include "ServerManager.h"
#include "FeatureServiceCache.h"
+#include "ResourceServiceCache.h"
class MgServiceManager;
class MgFdoConnectionManager;
@@ -62,6 +63,9 @@
MgFeatureSourceCacheItem* GetFeatureSourceCacheItem(MgResourceIdentifier* resource);
MgSpatialContextCacheItem* GetSpatialContextCacheItem(MgResourceIdentifier* resource);
+ MgResourceServiceCache* GetResourceServiceCache();
+ MgResourceLayerDefinitionCacheItem* GetResourceLayerDefinitionCacheItem(MgResourceIdentifier* resource);
+
bool IsResourceChangeNotificationNeeded(MgResourceIdentifier* resource);
/// Data Members
@@ -74,6 +78,7 @@
MgFdoConnectionManager* m_fdoConnectionManager;
MgFeatureServiceCache m_featureServiceCache;
+ MgResourceServiceCache m_resourceServiceCache;
};
/// Inline Methods
@@ -83,4 +88,9 @@
return &m_featureServiceCache;
}
+inline MgResourceServiceCache* MgCacheManager::GetResourceServiceCache()
+{
+ return &m_resourceServiceCache;
+}
+
#endif
Modified: sandbox/adsk/2.6l/Server/src/Common/Manager/FdoConnectionManager.cpp
===================================================================
--- sandbox/adsk/2.6l/Server/src/Common/Manager/FdoConnectionManager.cpp 2015-10-17 15:55:04 UTC (rev 8784)
+++ sandbox/adsk/2.6l/Server/src/Common/Manager/FdoConnectionManager.cpp 2015-10-19 04:16:56 UTC (rev 8785)
@@ -305,6 +305,38 @@
provider,
resourceIdentifier->ToString(),
longTransactionName);
+
+ // special workaournd for Autodesk Oracle provider
+ // Decribe schema for each new connection
+ STRING providerName = providerInfo->GetProviderName();
+ if (providerName == L"Autodesk.Oracle")
+ {
+ MgFeatureServiceCache* fsCache = cacheManager->GetFeatureServiceCache();
+ Ptr<MgStringCollection> schemaNames = fsCache->GetSchemaNames(resourceIdentifier);
+ if (schemaNames)
+ {
+ for (int i = 0; i < schemaNames->GetCount(); i++)
+ {
+ STRING schemaName = schemaNames->GetItem(i);
+
+ Ptr<MgStringCollection> classNames = fsCache->GetClassNames(resourceIdentifier, schemaName);
+ if (classNames)
+ {
+ FdoPtr<FdoIDescribeSchema> fdoCommand = (FdoIDescribeSchema*)pFdoConnection->CreateCommand(FdoCommandType_DescribeSchema);
+ fdoCommand->SetSchemaName(schemaName.c_str());
+ FdoPtr<FdoStringCollection> fdoClassNames = FdoStringCollection::Create();
+ for (int j = 0; j < classNames->GetCount(); j++)
+ {
+ STRING className = classNames->GetItem(j);
+ fdoClassNames->Add(className.c_str());
+ }
+ fdoCommand->SetClassNames(fdoClassNames);
+ // Execute the command
+ FdoPtr <FdoFeatureSchemaCollection> ffsc = fdoCommand->Execute();
+ }
+ }
+ }
+ }
}
else
{
@@ -735,7 +767,7 @@
{
// We have a long transaction name match
INT32 useLimit = providerInfo->GetUseLimit();
- if (useLimit == -1 || pFdoConnectionCacheEntry->nUseTotal <= useLimit)
+ if (useLimit == -1 || pFdoConnectionCacheEntry->nUseCount <= useLimit)
{
// If the provider is a PerCommandThreaded/MultiThreaded provider, reuse existing
// connection only when reuseOnly is true (current connections count == pool size).
Modified: sandbox/adsk/2.6l/Server/src/Services/Feature/ServerDescribeSchema.cpp
===================================================================
--- sandbox/adsk/2.6l/Server/src/Services/Feature/ServerDescribeSchema.cpp 2015-10-17 15:55:04 UTC (rev 8784)
+++ sandbox/adsk/2.6l/Server/src/Services/Feature/ServerDescribeSchema.cpp 2015-10-19 04:16:56 UTC (rev 8785)
@@ -1200,6 +1200,19 @@
}
}
+
+ if (classNames->GetCount() > 1)
+ {
+ Ptr<MgStringCollection> schemaNames = m_featureServiceCache->GetSchemaNames(resource);
+ if (!schemaNames.p || !schemaNames->Contains(schemaName))
+ {
+ if (!schemaNames)
+ schemaNames = new MgStringCollection();
+ schemaNames->Add(schemaName);
+ m_featureServiceCache->SetSchemaNames(resource, schemaNames.p);
+ m_featureServiceCache->SetClassNames(resource, schemaName, classNames);
+ }
+ }
MG_FEATURE_SERVICE_CATCH_AND_THROW_WITH_FEATURE_SOURCE(L"MgServerDescribeSchema.GetIdentityProperties", resource)
Modified: sandbox/adsk/2.6l/Server/src/Services/Mapping/MappingUtil.cpp
===================================================================
--- sandbox/adsk/2.6l/Server/src/Services/Mapping/MappingUtil.cpp 2015-10-17 15:55:04 UTC (rev 8784)
+++ sandbox/adsk/2.6l/Server/src/Services/Mapping/MappingUtil.cpp 2015-10-19 04:16:56 UTC (rev 8785)
@@ -31,6 +31,7 @@
#include "SymbolVisitor.h"
#include "SymbolDefinition.h"
#include "TransformCache.h"
+#include "CacheManager.h"
#include <algorithm>
@@ -433,7 +434,9 @@
//get layer definition
Ptr<MgResourceIdentifier> layerid = mapLayer->GetLayerDefinition();
- ldf.reset(MgLayerBase::GetLayerDefinition(svcResource, layerid));
+ MgCacheManager* cacheManager = MgCacheManager::GetInstance();
+ Ptr<MgResourceLayerDefinitionCacheItem> cacheItem = cacheManager->GetResourceLayerDefinitionCacheItem(layerid);
+ MdfModel::LayerDefinition* layerDefinition = cacheItem->Get();
Ptr<MgLayerGroup> group = mapLayer->GetGroup();
@@ -463,9 +466,9 @@
-mapLayer->GetDisplayOrder(),
uig);
- MdfModel::VectorLayerDefinition* vl = dynamic_cast<MdfModel::VectorLayerDefinition*>(ldf.get());
- MdfModel::DrawingLayerDefinition* dl = dynamic_cast<MdfModel::DrawingLayerDefinition*>(ldf.get());
- MdfModel::GridLayerDefinition* gl = dynamic_cast<MdfModel::GridLayerDefinition*>(ldf.get());
+ MdfModel::VectorLayerDefinition* vl = dynamic_cast<MdfModel::VectorLayerDefinition*>(layerDefinition);
+ MdfModel::DrawingLayerDefinition* dl = dynamic_cast<MdfModel::DrawingLayerDefinition*>(layerDefinition);
+ MdfModel::GridLayerDefinition* gl = dynamic_cast<MdfModel::GridLayerDefinition*>(layerDefinition);
if (vl) //############################################################################ vector layer
{
Property changes on: sandbox/adsk/2.6l/Server/src/Services/Mapping/MappingUtil.cpp
___________________________________________________________________
Modified: svn:mergeinfo
- /branches/2.4/MgDev/Server/src/Services/Mapping/MappingUtil.cpp:6738-6741,6749-6756,6777-6783,6785-6787,6789,6791-6794,6796-6801,6954-6962,6986-7006
/sandbox/adsk/2.4j/Server/src/Services/Mapping/MappingUtil.cpp:6327-6535
/sandbox/jng/createruntimemap/Server/src/Services/Mapping/MappingUtil.cpp:7486-7555
/sandbox/rfc94/Server/src/Services/Mapping/MappingUtil.cpp:5099-5163
/trunk/MgDev/Server/src/Services/Mapping/MappingUtil.cpp:6250-6326
+ /branches/2.4/MgDev/Server/src/Services/Mapping/MappingUtil.cpp:6738-6741,6749-6756,6777-6783,6785-6787,6789,6791-6794,6796-6801,6954-6962,6986-7006
/sandbox/adsk/2.4j/Server/src/Services/Mapping/MappingUtil.cpp:6327-6535
/sandbox/adsk/3.0m/Server/Server/src/Services/Mapping/MappingUtil.cpp:8584
/sandbox/adsk/3.0m/Server/src/Services/Mapping/MappingUtil.cpp:8584
/sandbox/jng/createruntimemap/Server/src/Services/Mapping/MappingUtil.cpp:7486-7555
/sandbox/rfc94/Server/src/Services/Mapping/MappingUtil.cpp:5099-5163
/trunk/MgDev/Server/src/Services/Mapping/MappingUtil.cpp:6250-6326
Modified: sandbox/adsk/2.6l/Server/src/Services/Mapping/ServerMappingService.vcxproj
===================================================================
--- sandbox/adsk/2.6l/Server/src/Services/Mapping/ServerMappingService.vcxproj 2015-10-17 15:55:04 UTC (rev 8784)
+++ sandbox/adsk/2.6l/Server/src/Services/Mapping/ServerMappingService.vcxproj 2015-10-19 04:16:56 UTC (rev 8785)
@@ -121,7 +121,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>..\..\Common;..\..\Common\Base;..\..\Common\Manager;..\Feature;..\..\..\..\Common\Foundation;..\..\..\..\Common\Geometry;..\..\..\..\Common\PlatformBase;..\..\..\..\Common\MapGuideCommon;..\..\..\..\Common\MdfModel;..\..\..\..\Common\MdfParser;..\..\..\..\Common\Renderers;..\..\..\..\Common\Stylization;..\..\..\..\Oem\ACE\ACE_wrappers;..\..\..\..\Oem\dbxml\xerces-c-src\src;..\..\..\..\Oem\FDO\inc;..\..\..\..\Oem\FDO\inc\ExpressionEngine;..\..\Gws\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>..\..\Common;..\..\Common\Cache;..\..\Common\Base;..\..\Common\Manager;..\Feature;..\..\..\..\Common\Foundation;..\..\..\..\Common\Geometry;..\..\..\..\Common\PlatformBase;..\..\..\..\Common\MapGuideCommon;..\..\..\..\Common\MdfModel;..\..\..\..\Common\MdfParser;..\..\..\..\Common\Renderers;..\..\..\..\Common\Stylization;..\..\..\..\Oem\ACE\ACE_wrappers;..\..\..\..\Oem\dbxml\xerces-c-src\src;..\..\..\..\Oem\FDO\inc;..\..\..\..\Oem\FDO\inc\ExpressionEngine;..\..\Gws\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MG_SERVER_MAPPING_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Async</ExceptionHandling>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@@ -176,7 +176,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
- <AdditionalIncludeDirectories>..\..\Common;..\..\Common\Base;..\..\Common\Manager;..\Feature;..\..\..\..\Common\Foundation;..\..\..\..\Common\Geometry;..\..\..\..\Common\PlatformBase;..\..\..\..\Common\MapGuideCommon;..\..\..\..\Common\MdfModel;..\..\..\..\Common\MdfParser;..\..\..\..\Common\Renderers;..\..\..\..\Common\Stylization;..\..\..\..\Oem\ACE\ACE_wrappers;..\..\..\..\Oem\dbxml\xerces-c-src\src;..\..\..\..\Oem\FDO\inc;..\..\..\..\Oem\FDO\inc\ExpressionEngine;..\..\Gws\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>..\..\Common\Cache;..\..\Common;..\..\Common\Base;..\..\Common\Manager;..\Feature;..\..\..\..\Common\Foundation;..\..\..\..\Common\Geometry;..\..\..\..\Common\PlatformBase;..\..\..\..\Common\MapGuideCommon;..\..\..\..\Common\MdfModel;..\..\..\..\Common\MdfParser;..\..\..\..\Common\Renderers;..\..\..\..\Common\Stylization;..\..\..\..\Oem\ACE\ACE_wrappers;..\..\..\..\Oem\dbxml\xerces-c-src\src;..\..\..\..\Oem\FDO\inc;..\..\..\..\Oem\FDO\inc\ExpressionEngine;..\..\Gws\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MG_SERVER_MAPPING_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Async</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -396,6 +396,9 @@
<Project>{a4f7f6b2-0e74-4dfd-b283-c7e380bd6f58}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
+ <ProjectReference Include="..\..\Common\Cache\ServerCache.vcxproj">
+ <Project>{531778c6-c340-40f2-b403-9b58b8121aab}</Project>
+ </ProjectReference>
<ProjectReference Include="..\..\Common\Manager\ServerManager.vcxproj">
<Project>{adbf25e2-c629-4832-b315-f12abde05632}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
Modified: sandbox/adsk/2.6l/Server/src/Services/Rendering/ServerRenderingService.cpp
===================================================================
--- sandbox/adsk/2.6l/Server/src/Services/Rendering/ServerRenderingService.cpp 2015-10-17 15:55:04 UTC (rev 8784)
+++ sandbox/adsk/2.6l/Server/src/Services/Rendering/ServerRenderingService.cpp 2015-10-19 04:16:56 UTC (rev 8785)
@@ -29,6 +29,7 @@
#include "LegendPlotUtil.h"
#include "TransformCache.h"
#include "Box2D.h"
+#include "CacheManager.h"
// Profile
#include "ProfileRenderMapResult.h"
@@ -1297,8 +1298,10 @@
//get the MDF layer definition
Ptr<MgResourceIdentifier> layerResId = layer->GetLayerDefinition();
- auto_ptr<MdfModel::LayerDefinition> ldf(MgLayerBase::GetLayerDefinition(m_svcResource, layerResId));
- MdfModel::VectorLayerDefinition* vl = dynamic_cast<MdfModel::VectorLayerDefinition*>(ldf.get());
+ MgCacheManager* cacheManager = MgCacheManager::GetInstance();
+ Ptr<MgResourceLayerDefinitionCacheItem> cacheItem = cacheManager->GetResourceLayerDefinitionCacheItem(layerResId);
+ MdfModel::LayerDefinition* layerDefinition = cacheItem->Get();
+ MdfModel::VectorLayerDefinition* vl = dynamic_cast<MdfModel::VectorLayerDefinition*>(layerDefinition);
//we can only do geometric query selection for vector layers
if (vl)
@@ -1764,9 +1767,10 @@
Ptr<MgLayerBase> mapLayer(layers->GetItem(i));
Ptr<MgResourceIdentifier> layerid = mapLayer->GetLayerDefinition();
- ldf.reset(MgLayerBase::GetLayerDefinition(m_svcResource, layerid));
-
- WatermarkInstanceCollection* layerWatermarks = ldf->GetWatermarks();
+ MgCacheManager* cacheManager = MgCacheManager::GetInstance();
+ Ptr<MgResourceLayerDefinitionCacheItem> cacheItem = cacheManager->GetResourceLayerDefinitionCacheItem(layerid);
+ MdfModel::LayerDefinition* layerDefinition = cacheItem->Get();
+ WatermarkInstanceCollection* layerWatermarks = layerDefinition->GetWatermarks();
for (int j=layerWatermarks->GetCount()-1; j>=0; j--)
tempWatermarkInstances.Adopt(layerWatermarks->OrphanAt(j));
for (int j=tempWatermarkInstances.GetCount()-1; j>=0; j--)
Modified: sandbox/adsk/2.6l/Server/src/Services/Rendering/ServerRenderingService.vcxproj
===================================================================
--- sandbox/adsk/2.6l/Server/src/Services/Rendering/ServerRenderingService.vcxproj 2015-10-17 15:55:04 UTC (rev 8784)
+++ sandbox/adsk/2.6l/Server/src/Services/Rendering/ServerRenderingService.vcxproj 2015-10-19 04:16:56 UTC (rev 8785)
@@ -120,7 +120,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<Optimization>Disabled</Optimization>
- <AdditionalIncludeDirectories>..\..\Common;..\..\Common\Base;..\..\Common\Manager;..\Feature;..\Mapping;..\..\..\..\Common\Foundation;..\..\..\..\Common\Geometry;..\..\..\..\Common\PlatformBase;..\..\..\..\Common\MapGuideCommon;..\..\..\..\Common\MdfModel;..\..\..\..\Common\Renderers;..\..\..\..\Common\Stylization;..\..\..\..\Oem\ACE\ACE_wrappers;..\..\..\..\Oem\dbxml\xerces-c-src\src;..\..\..\..\Oem\FDO\inc;..\..\..\..\Oem\FDO\inc\ExpressionEngine;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>..\..\Common\Cache;..\..\Common;..\..\Common\Base;..\..\Common\Manager;..\Feature;..\Mapping;..\..\..\..\Common\Foundation;..\..\..\..\Common\Geometry;..\..\..\..\Common\PlatformBase;..\..\..\..\Common\MapGuideCommon;..\..\..\..\Common\MdfModel;..\..\..\..\Common\Renderers;..\..\..\..\Common\Stylization;..\..\..\..\Oem\ACE\ACE_wrappers;..\..\..\..\Oem\dbxml\xerces-c-src\src;..\..\..\..\Oem\FDO\inc;..\..\..\..\Oem\FDO\inc\ExpressionEngine;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MG_SERVER_RENDERING_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Async</ExceptionHandling>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
@@ -173,7 +173,7 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<Optimization>MaxSpeed</Optimization>
- <AdditionalIncludeDirectories>..\..\Common;..\..\Common\Base;..\..\Common\Manager;..\Feature;..\Mapping;..\..\..\..\Common\Foundation;..\..\..\..\Common\Geometry;..\..\..\..\Common\PlatformBase;..\..\..\..\Common\MapGuideCommon;..\..\..\..\Common\MdfModel;..\..\..\..\Common\Renderers;..\..\..\..\Common\Stylization;..\..\..\..\Oem\ACE\ACE_wrappers;..\..\..\..\Oem\dbxml\xerces-c-src\src;..\..\..\..\Oem\FDO\inc;..\..\..\..\Oem\FDO\inc\ExpressionEngine;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+ <AdditionalIncludeDirectories>..\..\Common\Cache;..\..\Common;..\..\Common\Base;..\..\Common\Manager;..\Feature;..\Mapping;..\..\..\..\Common\Foundation;..\..\..\..\Common\Geometry;..\..\..\..\Common\PlatformBase;..\..\..\..\Common\MapGuideCommon;..\..\..\..\Common\MdfModel;..\..\..\..\Common\Renderers;..\..\..\..\Common\Stylization;..\..\..\..\Oem\ACE\ACE_wrappers;..\..\..\..\Oem\dbxml\xerces-c-src\src;..\..\..\..\Oem\FDO\inc;..\..\..\..\Oem\FDO\inc\ExpressionEngine;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MG_SERVER_RENDERING_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>Async</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -330,6 +330,9 @@
<Project>{a4f7f6b2-0e74-4dfd-b283-c7e380bd6f58}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
+ <ProjectReference Include="..\..\Common\Cache\ServerCache.vcxproj">
+ <Project>{531778c6-c340-40f2-b403-9b58b8121aab}</Project>
+ </ProjectReference>
<ProjectReference Include="..\..\Common\Manager\ServerManager.vcxproj">
<Project>{adbf25e2-c629-4832-b315-f12abde05632}</Project>
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
More information about the mapguide-commits
mailing list