diff options
Diffstat (limited to 'configmgr/source/treecache/cachecontroller.cxx')
-rw-r--r-- | configmgr/source/treecache/cachecontroller.cxx | 132 |
1 files changed, 0 insertions, 132 deletions
diff --git a/configmgr/source/treecache/cachecontroller.cxx b/configmgr/source/treecache/cachecontroller.cxx index 6aa34a68ca..513e134e5a 100644 --- a/configmgr/source/treecache/cachecontroller.cxx +++ b/configmgr/source/treecache/cachecontroller.cxx @@ -151,138 +151,6 @@ void CacheController::dispose() SAL_THROW((com::sun::star::uno::RuntimeException } // ------------------------------------------------------------------------- -void CacheController::disposeOne(RequestOptions const & _aOptions, bool _bFlushUpdates) -{ - CFG_TRACE_INFO("CacheController: Disposing data and TreeInfo for user '%s' with locale '%s'", - OUSTRING2ASCII(_aOptions.getEntity()), OUSTRING2ASCII(_aOptions.getLocale()) ); - - m_pDisposer->clearTasks(_aOptions); - if (!m_pCacheWriter->clearTasks(_aOptions)) // had no pending updates - { - _bFlushUpdates = false; - } - else if (!_bFlushUpdates) - { - CFG_TRACE_WARNING_NI("Found orphaned Changes in the cache - Discarding."); - } - - rtl::Reference<CacheLoadingAccess> aRemoved = m_aCacheMap.remove(_aOptions); - - if (aRemoved.is()) - { - // got it out of reachability - now dispose/notify without lock - implDisposeOne(aRemoved, _aOptions, _bFlushUpdates); - } - else - CFG_TRACE_INFO_NI("- No affected TreeInfo found" ); -} - -// ------------------------------------------------------------------------- -void CacheController::disposeUser(RequestOptions const & _aUserOptions, bool _bFlushUpdates) -{ - CFG_TRACE_INFO("CacheController: Disposing data and TreeInfo(s) for user '%s'", - OUSTRING2ASCII(_aUserOptions.getEntity()) ); - - std::vector< std::pair< RequestOptions, rtl::Reference<CacheLoadingAccess> > > aDisposeList; - // collect the ones to dispose - { - rtl::OUString sUser = _aUserOptions.getEntity(); - OSL_ASSERT(sUser.getLength()); - - // This depends on the fact that Options are sorted (by struct ltOptions) - // so that all options belonging to one user are together - // (and that options with only a user set, sort first) - - CacheMap::Map aCacheData; - m_aCacheMap.swap(aCacheData); - - // find the lower_bound of all options for the user - CacheMap::Map::iterator const aFirst = aCacheData.lower_bound(_aUserOptions); - - // find the upper_bound of all options for the user (using the lower one) - CacheMap::Map::iterator aLast = aFirst; - while (aLast != aCacheData.end() && aLast->first.getEntity() == sUser) - ++aLast; - - if (aFirst != aLast) - { - aDisposeList.reserve( std::distance(aFirst, aLast) ); - - bool bHasPendingChanges = false; - - for (CacheMap::Map::iterator it = aFirst; it != aLast; ++it) - { - CFG_TRACE_INFO_NI("- Found TreeInfo for locale '%s'", OUSTRING2ASCII(it->first.getLocale()) ); - m_pDisposer->clearTasks(it->first); - - if (m_pCacheWriter->clearTasks(it->first)) - bHasPendingChanges = true; - - OSL_ASSERT(it->second.is()); - if (it->second.is()) - { - //aDisposeList.push_back( *it ); - aDisposeList.push_back( std::make_pair(it->first,it->second) ); - } - } - - if (!bHasPendingChanges) - _bFlushUpdates = false; - - else if (!_bFlushUpdates) - CFG_TRACE_WARNING_NI("Found orphaned Changes in the cache - Discarding."); - - aCacheData.erase(aFirst, aLast); - } - else - CFG_TRACE_INFO_NI("- No affected TreeInfo found" ); - - // replace the data into the map - m_aCacheMap.swap(aCacheData); - } - - // got all out of external reach - now dispose/notify without lock - for (std::vector< std::pair< RequestOptions, rtl::Reference<CacheLoadingAccess> > >::iterator i = aDisposeList.begin(); i != aDisposeList.end(); ++i) - { - if (i->second.is()) - implDisposeOne(i->second, i->first, _bFlushUpdates); - } -} - -// ------------------------------------------------------------------------- -void CacheController::implDisposeOne(rtl::Reference<CacheLoadingAccess> const & _aDisposedCache, RequestOptions const & _aOptions, bool _bFlushUpdates) -{ - OSL_ASSERT(_aDisposedCache.is()); - CFG_TRACE_INFO("Now removing Cache section (user '%s' with locale '%s')", - OUSTRING2ASCII(_aOptions.getEntity()), OUSTRING2ASCII(_aOptions.getLocale()) ); - - if (_bFlushUpdates) try - { - CFG_TRACE_INFO_NI("- Flushing pending changes" ); - - if ( !this->saveAllPendingChanges(_aDisposedCache,_aOptions) ) - { - CFG_TRACE_ERROR_NI("- Error while flushing - changes will be lost" ); - OSL_ENSURE(false,"Error while flushing changes from discarded Cache section - changes will be lost" ); - } - } - catch (uno::Exception& e) - { - (void)e; - CFG_TRACE_ERROR_NI("- Failed with exception %s (ignoring here)", OUSTRING2ASCII(e.Message) ); - } - - std::vector< rtl::Reference<CacheLine> > aDisposedList; - _aDisposedCache->clearData(aDisposedList); - - if (aDisposedList.size() > 0) - { - CFG_TRACE_INFO_NI("- Closing %d modules at the session",int(aDisposedList.size())); - this->closeModules(aDisposedList,_aOptions); - } -} - -// ------------------------------------------------------------------------- CacheController::CacheController(rtl::Reference< backend::IMergedDataProvider > const & _xBackend, const uno::Reference<uno::XComponentContext>& xContext) : m_aNotifier() |