MapGuide Open Source:  Home |  Download |  Internals

Changeset 3218

Show
Ignore:
Timestamp:
06/18/08 22:31:18 (2 months ago)
Author:
stevedang
Message:

#610: Raster performance and stability.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/MgDev/Common/Renderers/AGGRenderer.cpp

    r3206 r3218  
    12711271                             double           angleRad) 
    12721272{ 
     1273    if (NULL == font) 
     1274    { 
     1275        return; 
     1276    } 
     1277 
    12731278    // Don't draw the text if height > 16384 pixels, since memory usage when 
    12741279    // evaluating the glyphs will get too large.  16394 pixels should be 
  • trunk/MgDev/Common/Renderers/DWFRenderer.cpp

    r3087 r3218  
    29502950                             double           angleRad) 
    29512951{ 
     2952    if (NULL == font) 
     2953    { 
     2954        return; 
     2955    } 
     2956 
    29522957    // draw to the active file if it's set 
    29532958    WT_File* file = m_w2dActive? m_w2dActive : m_w2dFile; 
  • trunk/MgDev/Common/Renderers/FontManager.cpp

    r3180 r3218  
    4646 
    4747//  static initializations 
    48 FontManager FontManager::m_manager; 
     48CustomThreadMutex FontManager::sm_mutex; 
     49FontManager FontManager::sm_manager; 
    4950 
    5051 
     
    5657FontManager::FontManager() 
    5758{ 
     59    AutoMutexLocker autoLocker(sm_mutex); 
     60 
    5861    FT_Init_FreeType(&m_library);  //  TODO:  check error code 
    5962 
    60     m_manager.init_font_list(); 
     63    sm_manager.init_font_list(); 
    6164} 
    6265 
     
    6467FontManager::~FontManager() 
    6568{ 
     69    AutoMutexLocker autoLocker(sm_mutex); 
     70 
    6671    FaceMapIterator it; 
    6772    FaceMapEntryType* pEntry = NULL; 
     
    120125FontManager* FontManager::Instance() 
    121126{ 
    122     return &m_manager; 
     127    return &sm_manager; 
    123128} 
    124129 
     
    126131int FontManager::get_face(const char* filename, FT_Long index, FT_Face* face) 
    127132{ 
     133    AutoMutexLocker autoLocker(sm_mutex); 
     134 
    128135    int ret = 0;                      //  our return error code 
    129136    FaceMapIterator it;               //  an interator 
     
    169176FaceMapEntryType* FontManager::load_file(const char* filename) 
    170177{ 
     178    AutoMutexLocker autoLocker(sm_mutex); 
     179 
    171180    int errcode = 0;                  //  an error code 
    172181    FaceMapEntryType* pEntry = NULL;  //  pointer to return value 
     
    214223void FontManager::init_font_list() 
    215224{ 
     225    AutoMutexLocker autoLocker(sm_mutex); 
     226 
    216227    int error = 0; 
    217228 
     
    282293void FontManager::init_font_list() 
    283294{ 
     295    AutoMutexLocker autoLocker(sm_mutex); 
     296 
    284297    int error = 0; 
    285298 
     
    432445    font->m_underline_thickness = face->underline_thickness; 
    433446 
     447    AutoMutexLocker autoLocker(sm_mutex); 
     448 
    434449    // add the font 
    435450    m_fontlist.push_front(font); 
     
    443458{ 
    444459    if (alias != NULL && asciiName != NULL) 
     460    { 
     461        AutoMutexLocker autoLocker(sm_mutex); 
     462 
    445463        m_fontAliases.insert(FontMapPair(new wstring(alias), new wstring(asciiName))); 
     464    } 
    446465} 
    447466 
     
    457476const RS_Font* FontManager::FindFont(const wstring& sfontname, bool bold, bool italic) 
    458477{ 
     478    AutoMutexLocker autoLocker(sm_mutex); 
     479 
    459480    // first see if we cached the font match so we don't have to iterate 
    460481    NameCacheEntry entry = m_matchedCache[sfontname]; 
  • trunk/MgDev/Common/Renderers/FontManager.h

    r2904 r3218  
    2121#include "Renderers.h" 
    2222#include "RS_Font.h"    // for FontList 
     23#include "CriticalSection.h" 
    2324 
    2425// FreeType includes 
     
    8788        map<wstring, NameCacheEntry> m_matchedCache; 
    8889 
    89         static FontManager m_manager; 
     90        static CustomThreadMutex sm_mutex; 
     91        static FontManager sm_manager; 
    9092}; 
    9193 
  • trunk/MgDev/Common/Renderers/Makefile.am

    r2657 r3218  
    2424  AGGFillPatterns.cpp \ 
    2525  ../../Oem/agg-2.4/font_freetype/agg_font_freetype.cpp \ 
     26  CriticalSection.cpp \ 
    2627  DWFRenderer.cpp \ 
    2728  EMapRenderer.cpp \ 
     
    5051  AGGW2DRewriter.h \ 
    5152  AGGFillPatterns.h \ 
     53  CriticalSection.h \ 
    5254  DWFRenderer.h \ 
    5355  DWFRSInputStream.h \ 
  • trunk/MgDev/Common/Renderers/Renderers.vcproj

    r3208 r3218  
    687687                </Filter> 
    688688                <File 
     689                        RelativePath=".\CriticalSection.cpp" 
     690                        > 
     691                </File> 
     692                <File 
     693                        RelativePath=".\CriticalSection.h" 
     694                        > 
     695                </File> 
     696                <File 
    689697                        RelativePath=".\Renderers.h" 
    690698                        > 
  • trunk/MgDev/Server/src/Common/Cache/FeatureServiceCache.cpp

    r3114 r3218  
    266266    Ptr<MgFeatureServiceCacheEntry> entry = GetEntry(resource); 
    267267 
    268     if (NULL != entry.p) 
    269     { 
    270         Ptr<MgFeatureSourceCacheItem> data = entry->GetFeatureSource(); 
    271  
    272         if (NULL != data.p) 
    273         { 
    274             RemoveEntry(resource); 
    275             entry = NULL; 
    276         } 
    277     } 
    278  
    279268    if (NULL == entry.p) 
    280269    { 
     
    306295    Ptr<MgFeatureServiceCacheEntry> entry = GetEntry(resource); 
    307296 
    308     if (NULL != entry.p) 
    309     { 
    310         Ptr<MgSpatialContextCacheItem> data = entry->GetSpatialContextInfo(); 
    311  
    312         if (NULL != data.p) 
    313         { 
    314             RemoveEntry(resource); 
    315             entry = NULL; 
    316         } 
    317     } 
    318  
    319297    if (NULL == entry.p) 
    320298    { 
     
    345323 
    346324    Ptr<MgFeatureServiceCacheEntry> entry = GetEntry(resource); 
    347  
    348     if (NULL != entry.p) 
    349     { 
    350         Ptr<MgSpatialContextReader> data = entry->GetSpatialContextReader(); 
    351  
    352         if (NULL != data.p) 
    353         { 
    354             RemoveEntry(resource); 
    355             entry = NULL; 
    356         } 
    357     } 
    358325 
    359326    if (NULL == entry.p) 
     
    377344        data = entry->GetSpatialContextReader(); 
    378345 
     346        // Make sure this cached data is only used by one thread at a time. 
    379347        if (NULL != data.p 
    380             && entry->GetActiveFlag() != active) 
     348            && (data->GetRefCount() > 2 
     349                || entry->GetActiveFlag() != active)) 
    381350        { 
    382351            data = NULL; 
    383352        } 
    384     } 
    385  
    386     // Reset the reader 
    387     if(NULL != data.p) 
    388     { 
    389         data->Reset(); 
     353 
     354        // Reset the reader. 
     355        if (NULL != data.p) 
     356        { 
     357            data->Reset(); 
     358        } 
    390359    } 
    391360 
     
    399368    Ptr<MgFeatureServiceCacheEntry> entry = GetEntry(resource); 
    400369 
    401     if (NULL != entry.p) 
    402     { 
    403         Ptr<MgStringCollection> data = entry->GetFeatureSchemaNames(); 
    404  
    405         if (NULL != data.p) 
    406         { 
    407             RemoveEntry(resource); 
    408             entry = NULL; 
    409         } 
    410     } 
    411  
    412370    if (NULL == entry.p) 
    413371    { 
     
    433391} 
    434392 
    435 void MgFeatureServiceCache::SetFeatureSchemaCollection(MgResourceIdentifier* resource, CREFSTRING featureSchemaName, MgFeatureSchemaCollection* featureSchemaCollection, bool bSerialize) 
    436 
    437     ACE_MT(ACE_GUARD(ACE_Recursive_Thread_Mutex, ace_mon, m_mutex)); 
    438  
    439     Ptr<MgFeatureServiceCacheEntry> entry = GetEntry(resource); 
    440  
    441     if (NULL != entry.p) 
    442     { 
    443         Ptr<MgFeatureSchemaCollection> data = entry->GetFeatureSchemaCollection(); 
    444  
    445         if (NULL != data.p) 
    446         { 
    447             RemoveEntry(resource); 
    448             entry = NULL; 
    449         } 
    450     } 
     393void MgFeatureServiceCache::SetFeatureSchemaCollection(MgResourceIdentifier* resource, CREFSTRING featureSchemaName, bool serialized, MgFeatureSchemaCollection* featureSchemaCollection) 
     394
     395    ACE_MT(ACE_GUARD(ACE_Recursive_Thread_Mutex, ace_mon, m_mutex)); 
     396 
     397    Ptr<MgFeatureServiceCacheEntry> entry = GetEntry(resource); 
    451398 
    452399    if (NULL == entry.p) 
     
    456403 
    457404    entry->SetFeatureSchemaName(featureSchemaName); 
     405    entry->SetFeatureSchemaCollectionSerialized(serialized); 
    458406    entry->SetFeatureSchemaCollection(featureSchemaCollection); 
    459     entry->SetFeatureSchemaCollectionSerialized(bSerialize); 
    460 
    461  
    462 MgFeatureSchemaCollection* MgFeatureServiceCache::GetFeatureSchemaCollection(MgResourceIdentifier* resource, CREFSTRING featureSchemaName, bool bSerialize) 
     407
     408 
     409MgFeatureSchemaCollection* MgFeatureServiceCache::GetFeatureSchemaCollection(MgResourceIdentifier* resource, CREFSTRING featureSchemaName, bool serialized) 
    463410{ 
    464411    ACE_MT(ACE_GUARD_RETURN(ACE_Recursive_Thread_Mutex, ace_mon, m_mutex, NULL)); 
     
    471418        data = entry->GetFeatureSchemaCollection(); 
    472419 
    473         // Skip this cached entry if requested different feature schema, 
    474         // or requested schema with serialized XML and cached schema not serialized. 
    475420        if (NULL != data.p 
    476             && (entry->GetFeatureSchemaName() != featureSchemaName || 
    477                 (!entry->GetFeatureSchemaCollectionSerialized()) && bSerialize)) 
     421            && (entry->GetFeatureSchemaName() != featureSchemaName 
     422                || entry->GetFeatureSchemaCollectionSerialized() != serialized)) 
    478423 
    479424        { 
     
    490435 
    491436    Ptr<MgFeatureServiceCacheEntry> entry = GetEntry(resource); 
    492  
    493     if (NULL != entry.p) 
    494     { 
    495         STRING data = entry->GetFeatureSchemaXml(); 
    496  
    497         if (!data.empty()) 
    498         { 
    499             RemoveEntry(resource); 
    500             entry = NULL; 
    501         } 
    502     } 
    503437 
    504438    if (NULL == entry.p) 
     
    538472    Ptr<MgFeatureServiceCacheEntry> entry = GetEntry(resource); 
    539473 
    540     if (NULL != entry.p) 
    541     { 
    542         Ptr<MgStringCollection> data = entry->GetFeatureClassNames(); 
    543  
    544         if (NULL != data.p) 
    545         { 
    546             RemoveEntry(resource); 
    547             entry = NULL; 
    548         } 
    549     } 
    550  
    551474    if (NULL == entry.p) 
    552475    { 
     
    584507 
    585508    Ptr<MgFeatureServiceCacheEntry> entry = GetEntry(resource); 
    586  
    587     if (NULL != entry.p) 
    588     { 
    589         Ptr<MgClassDefinition> data = entry->GetFeatureClassDefinition(); 
    590  
    591         if (NULL != data.p) 
    592         { 
    593             RemoveEntry(resource); 
    594             entry = NULL; 
    595         } 
    596     } 
    597509 
    598510    if (NULL == entry.p) 
     
    617529        data = entry->GetFeatureClassDefinition(); 
    618530 
    619         if ( NULL != data.p && 
    620              (entry->GetFeatureSchemaName() != featureSchemaName || entry->GetFeatureClassName() != featureClassName) ) 
     531        if (NULL != data.p 
     532            && (entry->GetFeatureSchemaName() != featureSchemaName 
     533                || entry->GetFeatureClassName() != featureClassName)) 
    621534        { 
    622535            data = NULL; 
     
    632545 
    633546    Ptr<MgFeatureServiceCacheEntry> entry = GetEntry(resource); 
    634  
    635     if (NULL != entry.p) 
    636     { 
    637         if (entry->GetFeatureSchemaName() != featureSchemaName) 
    638         { 
    639             RemoveEntry(resource); 
    640             entry = NULL; 
    641         } 
    642         else if (entry->GetFeatureClassName() != featureClassName) 
    643         { 
    644             entry->SetFeatureClassDefinition((MgClassDefinition*) NULL); 
    645         } 
    646     } 
    647547 
    648548    if (NULL == entry.p) 
     
    669569        if (NULL != data.p 
    670570            && (entry->GetFeatureSchemaName() != featureSchemaName 
    671             || entry->GetFeatureClassName() != featureClassName)) 
     571                || entry->GetFeatureClassName() != featureClassName)) 
    672572        { 
    673573            data = NULL; 
     
    693593    Ptr<MgFeatureServiceCacheEntry> entry = GetEntry(resource); 
    694594 
    695     if (NULL != entry.p) 
    696     { 
    697         FdoPtr<FdoFeatureSchemaCollection> data = entry->GetFdoFeatureSchemaCollection(); 
    698  
    699         if (NULL != data.p) 
    700         { 
    701             RemoveEntry(resource); 
    702             entry = NULL; 
    703         } 
    704     } 
    705  
    706595    if (NULL == entry.p) 
    707596    { 
     
    725614        data = entry->GetFdoFeatureSchemaCollection(); 
    726615 
    727         // Skip this cached entry if requested different feature schema 
    728616        if (NULL != data.p 
    729             && (entry->GetFeatureSchemaName() != featureSchemaName)) 
    730  
     617            && entry->GetFeatureSchemaName() != featureSchemaName) 
    731618        { 
    732619            data = NULL; 
    733620        } 
     621 
     622        // Make sure this cached data is only used by one thread at a time. 
    734623        if (NULL != data.p) 
    735624        { 
     
    745634    return data.Detach(); 
    746635} 
    747  
    748  
  • trunk/MgDev/Server/src/Common/Cache/FeatureServiceCache.h

    r3114 r3218  
    6666    MgStringCollection* GetFeatureSchemaNames(MgResourceIdentifier* resource); 
    6767 
    68     void SetFeatureSchemaCollection(MgResourceIdentifier* resource, CREFSTRING featureSchemaName, MgFeatureSchemaCollection* featureSchemaCollection, bool bSerialize); 
    69     MgFeatureSchemaCollection* GetFeatureSchemaCollection(MgResourceIdentifier* resource, CREFSTRING featureSchemaName, bool bSerialize); 
     68    void SetFeatureSchemaCollection(MgResourceIdentifier* resource, CREFSTRING featureSchemaName, bool serialized, MgFeatureSchemaCollection* featureSchemaCollection); 
     69    MgFeatureSchemaCollection* GetFeatureSchemaCollection(MgResourceIdentifier* resource, CREFSTRING featureSchemaName, bool serialized); 
    7070 
    7171    void SetFeatureSchemaXml(MgResourceIdentifier* resource, CREFSTRING featureSchemaName, CREFSTRING featureSchemaXml); 
     
    9696private: 
    9797 
     98    friend class MgCacheManager; 
     99 
    98100    MgFeatureServiceCacheEntries m_featureServiceCacheEntries; 
    99101}; 
  • trunk/MgDev/Server/src/Common/Cache/FeatureServiceCacheEntry.cpp

    r3090 r3218  
    2424/// 
    2525MgFeatureServiceCacheEntry::MgFeatureServiceCacheEntry() : 
    26     m_active(false) 
     26    m_active(false), 
     27    m_featureSchemaCollectionSerialized(false) 
    2728{ 
    2829} 
     
    6768void MgFeatureServiceCacheEntry::SetFeatureSchemaName(CREFSTRING featureSchemaName) 
    6869{ 
    69     if ( featureSchemaName != m_featureSchemaName )  
     70    if (!m_featureSchemaName.empty() && featureSchemaName != m_featureSchemaName) 
    7071    { 
     72        SetFeatureSchemaCollectionSerialized(false); 
    7173        SetFeatureSchemaCollection((MgFeatureSchemaCollection*) NULL); 
     74        SetFdoFeatureSchemaCollection((FdoFeatureSchemaCollection*) NULL); 
    7275        SetFeatureSchemaXml(L""); 
    73         SetFdoFeatureSchemaCollection((FdoFeatureSchemaCollection*) NULL); 
    7476        SetFeatureClassNames((MgStringCollection*) NULL); 
    7577        SetFeatureClassName(L""); 
     
    7779 
    7880    m_featureSchemaName = featureSchemaName; 
    79  
    8081} 
    8182 
    8283void MgFeatureServiceCacheEntry::SetFeatureClassName(CREFSTRING featureClassName) 
    8384{ 
    84     if ( featureClassName != m_featureClassName )  
     85    if (!m_featureClassName.empty() && featureClassName != m_featureClassName) 
    8586    { 
    8687        SetFeatureClassDefinition((MgClassDefinition*) NULL); 
    8788        SetFeatureClassIdentityProperties((MgPropertyDefinitionCollection*) NULL); 
    8889    } 
     90 
    8991    m_featureClassName = featureClassName; 
    9092} 
     
    110112} 
    111113 
     114void MgFeatureServiceCacheEntry::SetFeatureSchemaCollectionSerialized(bool serialized) 
     115{ 
     116    m_featureSchemaCollectionSerialized = serialized; 
     117} 
     118 
    112119void MgFeatureServiceCacheEntry::SetFeatureSchemaCollection(MgFeatureSchemaCollection* featureSchemaCollection) 
    113120{ 
     
    120127} 
    121128 
    122 void MgFeatureServiceCacheEntry::SetFeatureSchemaCollectionSerialized(bool bSerialized) 
    123 { 
    124     m_featureSchemaCollectionSerialized = bSerialized; 
    125 } 
    126  
    127 bool MgFeatureServiceCacheEntry::GetFeatureSchemaCollectionSerialized() 
    128 { 
    129     return m_featureSchemaCollectionSerialized; 
    130 } 
    131  
    132129void MgFeatureServiceCacheEntry::SetFeatureSchemaXml(CREFSTRING featureSchemaXml) 
    133130{ 
    134131    m_featureSchemaXml = featureSchemaXml; 
    135 } 
    136  
    137 STRING MgFeatureServiceCacheEntry::GetFeatureSchemaXml() 
    138 { 
    139     return m_featureSchemaXml; 
    140132} 
    141133 
     
    172164void MgFeatureServiceCacheEntry::SetFdoFeatureSchemaCollection(FdoFeatureSchemaCollection* featureSchemaCollection) 
    173165{ 
    174     m_FdoFeatureSchemaCollection = SAFE_ADDREF(featureSchemaCollection); 
     166    // Note that the caller must ensure this pointer's reference counter is 
     167    // thread safe when calling this method. 
     168    m_fdoFeatureSchemaCollection = FDO_SAFE_ADDREF(featureSchemaCollection); 
    175169} 
    176170 
    177171FdoFeatureSchemaCollection* MgFeatureServiceCacheEntry::GetFdoFeatureSchemaCollection() 
    178172{ 
    179     return SAFE_ADDREF(m_FdoFeatureSchemaCollection.p); 
     173    // Note that the caller must ensure this pointer's reference counter is 
     174    // thread safe when calling this method. 
     175    return FDO_SAFE_ADDREF(m_fdoFeatureSchemaCollection.p); 
    180176} 
    181  
  • trunk/MgDev/Server/src/Common/Cache/FeatureServiceCacheEntry.h

    r3090 r3218  
    5252    bool GetActiveFlag() const; 
    5353 
    54     void SetFeatureSchemaName(CREFSTRING featureSchemaName); 
    55     CREFSTRING GetFeatureSchemaName() const; 
    56  
    57     void SetFeatureClassName(CREFSTRING featureClassName); 
    58     CREFSTRING GetFeatureClassName() const; 
    59  
    6054    MgSpatialContextReader* GetSpatialContextReader(); 
    6155    void SetSpatialContextReader(MgSpatialContextReader* spatialContextReader); 
     
    6458    void SetFeatureSchemaNames(MgStringCollection* featureSchemaNames); 
    6559 
     60    void SetFeatureSchemaName(CREFSTRING featureSchemaName); 
     61    STRING GetFeatureSchemaName() const; 
     62 
     63    bool GetFeatureSchemaCollectionSerialized() const; 
     64    void SetFeatureSchemaCollectionSerialized(bool serialized); 
     65 
    6666    MgFeatureSchemaCollection* GetFeatureSchemaCollection(); 
    6767    void SetFeatureSchemaCollection(MgFeatureSchemaCollection* featureSchemaCollection); 
    6868 
    69     bool GetFeatureSchemaCollectionSerialized(); 
    70     void SetFeatureSchemaCollectionSerialized(bool bSerialized); 
     69    FdoFeatureSchemaCollection* GetFdoFeatureSchemaCollection(); 
     70    void SetFdoFeatureSchemaCollection(FdoFeatureSchemaCollection* featureSchemaCollection); 
    7171 
    72     STRING GetFeatureSchemaXml()
     72    STRING GetFeatureSchemaXml() const
    7373    void SetFeatureSchemaXml(CREFSTRING featureSchemaXml); 
    7474 
    7575    MgStringCollection* GetFeatureClassNames(); 
    7676    void SetFeatureClassNames(MgStringCollection* featureClassNames); 
     77 
     78    void SetFeatureClassName(CREFSTRING featureClassName); 
     79    STRING GetFeatureClassName() const; 
    7780 
    7881    MgClassDefinition* GetFeatureClassDefinition(); 
     
    8184    MgPropertyDefinitionCollection* GetFeatureClassIdentityProperties(); 
    8285    void SetFeatureClassIdentityProperties(MgPropertyDefinitionCollection* featureClassIdentityProperties); 
    83  
    84     FdoFeatureSchemaCollection* GetFdoFeatureSchemaCollection(); 
    85     void SetFdoFeatureSchemaCollection(FdoFeatureSchemaCollection* featureSchemaCollection); 
    8686 
    8787/// Data Members 
     
    9999    STRING m_featureSchemaName; 
    100100 
     101    bool m_featureSchemaCollectionSerialized; 
    101102    Ptr<MgFeatureSchemaCollection> m_featureSchemaCollection; 
    102     bool m_featureSchemaCollectionSerialized; 
     103 
     104    FdoPtr<FdoFeatureSchemaCollection> m_fdoFeatureSchemaCollection; 
     105 
    103106    STRING m_featureSchemaXml; 
    104107    Ptr<MgStringCollection> m_featureClassNames; 
     
    108111    Ptr<MgClassDefinition> m_featureClassDefinition; 
    109112    Ptr<MgPropertyDefinitionCollection> m_featureClassIdentityProperties; 
    110  
    111     FdoPtr<FdoFeatureSchemaCollection> m_FdoFeatureSchemaCollection; 
    112113}; 
    113114 
     
    119120} 
    120121 
    121 inline CREFSTRING MgFeatureServiceCacheEntry::GetFeatureSchemaName() const 
     122inline STRING MgFeatureServiceCacheEntry::GetFeatureSchemaName() const 
    122123{ 
    123124    return m_featureSchemaName; 
    124125} 
    125126 
    126 inline CREFSTRING MgFeatureServiceCacheEntry::GetFeatureClassName() const 
     127inline bool MgFeatureServiceCacheEntry::GetFeatureSchemaCollectionSerialized() const 
     128
     129    return m_featureSchemaCollectionSerialized; 
     130
     131 
     132inline STRING MgFeatureServiceCacheEntry::GetFeatureSchemaXml() const 
     133
     134    return m_featureSchemaXml; 
     135
     136 
     137inline STRING MgFeatureServiceCacheEntry::GetFeatureClassName() const 
    127138{ 
    128139    return m_featureClassName; 
  • trunk/MgDev/Server/src/Common/Manager/CacheManager.cpp

    r2908 r3218  
    116116void MgCacheManager::ClearCaches() 
    117117{ 
     118    // The mutex usage and the method call order here are important 
     119    // because they ensure all the caches are in sync. 
     120    ACE_MT(ACE_GUARD(ACE_Recursive_Thread_Mutex, ace_mon, m_featureServiceCache.m_mutex)); 
     121 
     122    m_fdoConnectionManager->ClearCache(); 
    118123    m_featureServiceCache.Clear(); 
    119     m_fdoConnectionManager->ClearCache(); 
    120124} 
    121125 
     
    128132    if (STRING::npos != resource.rfind(MgResourceType::FeatureSource)) 
    129133    { 
     134        // The mutex usage and the method call order here are important 
     135        // because they ensure all the caches are in sync. 
     136        ACE_MT(ACE_GUARD(ACE_Recursive_Thread_Mutex, ace_mon, m_featureServiceCache.m_mutex)); 
     137 
     138        m_fdoConnectionManager->RemoveCachedFdoConnection(resource); 
    130139        m_featureServiceCache.RemoveEntry(resource); 
     140    } 
     141} 
     142 
     143/////////////////////////////////////////////////////////////////////////////// 
     144/// \brief 
     145/// Notify the applicable caches of the changed resource. 
     146/// 
     147void MgCacheManager::NotifyResourcesChanged(MgResourceIdentifier* resource) 
     148{ 
     149    if (NULL != resource && resource->IsResourceTypeOf(MgResourceType::FeatureSource)) 
     150    { 
     151        // The mutex usage and the method call order here are important 
     152        // because they ensure all the caches are in sync. 
     153        ACE_MT(ACE_GUARD(ACE_Recursive_Thread_Mutex, ace_mon, m_featureServiceCache.m_mutex)); 
     154 
    131155        m_fdoConnectionManager->RemoveCachedFdoConnection(resource); 
    132     } 
    133 } 
    134  
    135 /////////////////////////////////////////////////////////////////////////////// 
    136 /// \brief 
    137 /// Notify the applicable caches of the changed resource. 
    138 /// 
    139 void MgCacheManager::NotifyResourcesChanged(MgResourceIdentifier* resource) 
    140 { 
    141     if (NULL != resource && resource->IsResourceTypeOf(MgResourceType::FeatureSource)) 
    142     { 
    143156        m_featureServiceCache.RemoveEntry(resource); 
    144         m_fdoConnectionManager->RemoveCachedFdoConnection(resource); 
    145157    } 
    146158} 
  • trunk/MgDev/Server/src/Common/Manager/Connection.cpp

    r2908 r3218  
    120120void MgConnection::SetBusy() 
    121121{ 
     122    ACE_MT(ACE_GUARD(ACE_Recursive_Thread_Mutex, ace_mon, m_mutex)); 
     123 
    122124    m_busy = true; 
    123125} 
     
    125127void MgConnection::ClearBusy() 
    126128{ 
     129    ACE_MT(ACE_GUARD(ACE_Recursive_Thread_Mutex, ace_mon, m_mutex)); 
     130 
    127131    m_busy = false; 
    128132} 
     
    137141bool MgConnection::IsExpired(INT32 nIdleTimeout) const 
    138142{ 
     143    ACE_MT(ACE_GUARD_RETURN(ACE_Recursive_Thread_Mutex, ace_mon, m_mutex, false)); 
     144 
    139145    bool bExpired = false; 
    140146 
     
    199205void MgConnection::UpdateLastUsageTime() 
    200206{ 
     207    ACE_MT(ACE_GUARD(ACE_Recursive_Thread_Mutex, ace_mon, m_mutex)); 
     208 
    201209    m_lastUsageTime = ACE_High_Res_Timer::gettimeofday(); 
    202210} 
  • trunk/MgDev/Server/src/Common/Manager/Connection.h

    r2908 r3218  
    9595private: 
    9696 
     97    mutable ACE_Recursive_Thread_Mutex m_mutex; 
    9798    bool m_busy; 
    9899 
  • trunk/MgDev/Server/src/Common/Manager/LongTransactionManager.cpp

    r2908 r3218  
    213213    if (expiredSessions != NULL) 
    214214    { 
     215        // The mutex usage is to ensure this operation is completed for all expired sessions at once. 
     216        ACE_MT(ACE_GUARD(ACE_Recursive_Thread_Mutex, ace_mon, sm_mutex)); 
     217 
    215218        for (INT32 i=0; i<expiredSessions->GetCount(); ++i) 
    216219            MgLongTransactionManager::RemoveLongTransactionNames(expiredSessions->GetItem(i)); 
  • trunk/MgDev/Server/src/Core/serverconfig.ini

    r3118 r3218  
    256256DataConnectionPoolExcludedProviders= OSGeo.SDF,OSGeo.SHP 
    257257DataConnectionPoolSize             = 200 
    258 DataConnectionPoolSizeCustom       = OSGeo.Gdal:1,Autodesk.Raster:1 
     258DataConnectionPoolSizeCustom       = OSGeo.Gdal:1 
    259259DataConnectionTimeout              = 28800 
    260260DataConnectionTimerInterval        = 3600 
  • trunk/MgDev/Server/src/Services/Feature/ServerDescribeSchema.cpp

    r3114 r3218  
    547547        // The following sets ffsc to NULL 
    548548        m_featureServiceCache->SetFdoFeatureSchemaCollection(resource, schemaName, ffsc); 
    549         m_featureServiceCache->SetFeatureSchemaCollection(resource, schemaName, fsCollection.p, serialize); 
     549        m_featureServiceCache->SetFeatureSchemaCollection(resource, schemaName, serialize, fsCollection.p); 
    550550    } 
    551551 
  • trunk/MgDev/Server/src/Services/Mapping/MappingUtil.cpp

    r3152 r3218  
    587587            else if (gl) 
    588588            { 
     589                // TODO: FDO RFP - Make FdoPtr's reference counter thread-safe. 
     590                static ACE_Recursive_Thread_Mutex sg_fdoRfpMutex; 
     591 
    589592                #ifdef _DEBUG 
    590593                long dwLayerStart = GetTickCount(); 
     
    611614 
    612615                    //get a transform from layer coord sys to map coord sys 
    613                     TransformCache* item = TransformCache::GetLayerToMapTransform(transformCache, gl->GetFeatureName(), featResId, dstCs, csFactory, svcFeature); 
     616                    TransformCache* item = NULL; 
     617                    { 
     618                        ACE_MT(ACE_GUARD(ACE_Recursive_Thread_Mutex, ace_mon, sg_fdoRfpMutex)); 
     619                        item = TransformCache::GetLayerToMapTransform(transformCache, gl->GetFeatureName(), featResId, dstCs, csFactory, svcFeature); 
     620                    } 
     621 
    614622                    Ptr<MgCoordinateSystem> layerCs = item? item->GetCoordSys() : NULL; 
    615623                    MgCSTrans* xformer = item? item->GetTransform() : NULL; 
     
    670678 
    671679                    //perform the raster query 
    672                     rsReader = ExecuteRasterQuery(svcFeature, extent, gl, overrideFilter.c_str(), dstCs, layerCs, width, height); 
     680                    { 
     681                        ACE_MT(ACE_GUARD(ACE_Recursive_Thread_Mutex, ace_mon, sg_fdoRfpMutex)); 
     682                        rsReader = ExecuteRasterQuery(svcFeature, extent, gl, overrideFilter.c_str(), dstCs, layerCs, width, height); 
     683                    } 
    673684 
    674685                    if (NULL != rsReader)