summaryrefslogtreecommitdiff
path: root/configmgr/source
diff options
context:
space:
mode:
authorJörg Barfurth <jb@openoffice.org>2002-07-12 10:42:50 +0000
committerJörg Barfurth <jb@openoffice.org>2002-07-12 10:42:50 +0000
commitecbecbe2b291101a863256c0bcf8f9c04514d60b (patch)
tree9d6a3ba495265a92357ad495127da3b0ad7f38b2 /configmgr/source
parentc0cc99deb962ec60e60fe59963f36b84464211b6 (diff)
#101270# Fixed problems with write scheduling
Diffstat (limited to 'configmgr/source')
-rw-r--r--configmgr/source/treecache/cachecontroller.cxx103
-rw-r--r--configmgr/source/treecache/cachecontroller.hxx10
-rw-r--r--configmgr/source/treecache/cachewritescheduler.cxx67
-rw-r--r--configmgr/source/treecache/treemanager.cxx59
4 files changed, 184 insertions, 55 deletions
diff --git a/configmgr/source/treecache/cachecontroller.cxx b/configmgr/source/treecache/cachecontroller.cxx
index fa7d85513e7d..5bba7ab3b14f 100644
--- a/configmgr/source/treecache/cachecontroller.cxx
+++ b/configmgr/source/treecache/cachecontroller.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: cachecontroller.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: jb $ $Date: 2002-07-11 15:50:39 $
+ * last change: $Author: jb $ $Date: 2002-07-12 11:42:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -170,7 +170,7 @@ memory::HeapManager & CacheController::getCacheHeapManager() const
// disposing
// -------------------------------------------------------------------------
-void CacheController::disposeAll()
+void CacheController::disposeAll(bool _bFlushRemainingUpdates)
{
CFG_TRACE_INFO("CacheController: Disposing all data" );
CacheList::Map aReleaseList;
@@ -183,6 +183,11 @@ void CacheController::disposeAll()
m_aCacheList.swap(aReleaseList); // move data out of m_aCacheList and empty m_aCacheList
}
+ if (_bFlushRemainingUpdates)
+ {
+ for (CacheList::Map::iterator it = aReleaseList.begin(); it != aReleaseList.end(); ++it)
+ saveAllPendingChanges(it->second,it->first);
+ }
// free all the trees
aReleaseList.clear();
}
@@ -190,7 +195,7 @@ void CacheController::disposeAll()
// -------------------------------------------------------------------------
void CacheController::dispose() CFG_UNO_THROW_RTE()
{
- CFG_TRACE_INFO("CacheController: dispoing the treemanager" );
+ CFG_TRACE_INFO("CacheController: dispose()" );
RTL_LOGFILE_CONTEXT_AUTHOR(aLog, "configmgr::CacheController", "jb99855", "dispose(), disable lazy write cache.");
m_bDisposing = true; // we are in dispose, handling of errors must be something different.
@@ -199,7 +204,7 @@ void CacheController::dispose() CFG_UNO_THROW_RTE()
this->flushPendingUpdates();
// cleaning the cache
- this->disposeAll();
+ this->disposeAll(true);
}
// -------------------------------------------------------------------------
@@ -212,10 +217,13 @@ void CacheController::disposeOne(RequestOptions const & _aOptions, bool _bFlushU
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.");
+ }
CacheRef aRemoved = m_aCacheList.remove(_aOptions);
@@ -311,14 +319,18 @@ void CacheController::disposeUser(RequestOptions const & _aUserOptions, bool _bF
void CacheController::implDisposeOne(CacheRef const & _aDisposedCache, RequestOptions const & _aOptions, bool _bFlushUpdates)
{
OSL_ASSERT(_aDisposedCache.is());
- CFG_TRACE_INFO("Now removing TreeInfo (user '%s' with locale '%s') and broadcaster",
+ 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" );
- this->saveAllPendingChanges(_aDisposedCache,_aOptions);
+ 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)
{
@@ -410,7 +422,7 @@ CacheLocation makeCacheLocation(memory::SegmentAddress const & _aSegment, memory
CacheLocation CacheController::loadComponent(ComponentRequest const & _aRequest)
{
- CFG_TRACE_INFO("cache manager: checking the cache");
+ CFG_TRACE_INFO("CacheController: loading component '%s'", OUSTRING2ASCII(_aRequest.getComponentName().toString()));
CacheRef aCache = this->getCacheAlways(_aRequest.getOptions());
@@ -422,7 +434,7 @@ CacheLocation CacheController::loadComponent(ComponentRequest const & _aRequest)
if (aCache->hasModule(_aRequest.getComponentName()))
{
- CFG_TRACE_INFO_NI("cache manager: found node in cache");
+ CFG_TRACE_INFO_NI("CacheController: found node in cache");
OSL_ENSURE(!_aRequest.getOptions().isForcingReload(),"CacheController: Found node in cache for non-cachable request");
aResultAddress = aCache->acquireModule(_aRequest.getComponentName());
@@ -433,6 +445,8 @@ CacheLocation CacheController::loadComponent(ComponentRequest const & _aRequest)
bool bWithDefaults = ! m_xBackend->isStrippingDefaults();
+ CFG_TRACE_INFO_NI("CacheController: adding loaded data to the cache");
+
memory::UpdateAccessor aTargetSpace( aCache->createNewDataSegment(_aRequest.getComponentName()) );
aResultAddress = aCache->addComponentData(aTargetSpace, aData.instance(), bWithDefaults);
@@ -503,7 +517,7 @@ AbsolutePath CacheController::ensureTemplate(const Name& _rName, Name const& _rM
{
OSL_ENSURE(!_rName.isEmpty(), "CacheController::ensureTemplate : invalid template name !");
- CFG_TRACE_INFO("cache manager: going to get a template named %s", OUSTRING2ASCII(_rName.toString()));
+ CFG_TRACE_INFO("CacheController: going to get a template named %s", OUSTRING2ASCII(_rName.toString()));
// OReadSynchronized aReadGuard(this);
osl::MutexGuard aGuard(m_aTemplatesMutex);
@@ -526,7 +540,7 @@ AbsolutePath CacheController::ensureTemplate(const Name& _rName, Name const& _rM
if (!m_aTemplates.hasNode(aTemplatesUpdater.accessor(),aTemplateParent))
{
- CFG_TRACE_INFO("cache manager: cache miss for that template");
+ CFG_TRACE_INFO_NI("CacheController: cache miss for that template - loading from backend");
TemplateRequest aTemplateRequest = TemplateRequest::forComponent(_rModule);
@@ -549,14 +563,19 @@ AbsolutePath CacheController::ensureTemplate(const Name& _rName, Name const& _rM
if (aMultiTemplates.get() != NULL)
{
- CFG_TRACE_INFO("cache manager: adding the templates to the cache");
+ CFG_TRACE_INFO_NI("CacheController: adding the loaded templates to the cache");
NodeInstance aTemplatesNode(aMultiTemplates, aTemplateParent);
m_aTemplates.addTemplates(aTemplatesUpdater, aTemplatesNode);
}
else
+ {
+ CFG_TRACE_ERROR_NI("CacheController: could not load the templates");
+
throw uno::Exception(::rtl::OUString::createFromAscii("The template description could not be loaded. The template does not exist."), NULL);
+
+ }
}
}
@@ -607,7 +626,7 @@ void CacheController::saveAndNotify(UpdateRequest const & _anUpdate) CFG_UNO_THR
{
// ---------- preworking on the changes ----------
// caller must own a read lock on this cache line
- CFG_TRACE_INFO("cache loading manager: saving an update");
+ CFG_TRACE_INFO("CacheController: saving an update for '%s'",OUSTRING2ASCII(_anUpdate.getUpdateRoot().toString()));
CacheRef aCache = m_aCacheList.get(_anUpdate.getOptions());
@@ -618,16 +637,24 @@ void CacheController::saveAndNotify(UpdateRequest const & _anUpdate) CFG_UNO_THR
aCache->addChangesToPending(_anUpdate.getUpdate());
if ( _anUpdate.isForcingFlush()|| m_bDisposing ) // cannot do it asynchronously
+ {
+ CFG_TRACE_INFO_NI("Running synchronous write");
savePendingChanges( aCache, getComponentRequest(_anUpdate) );
+ }
else
+ {
+ CFG_TRACE_INFO_NI("Posting asynchronous write");
m_pCacheWriter->scheduleWrite( getComponentRequest(_anUpdate) );
+ }
+ CFG_TRACE_INFO_NI("Notifying the changes");
// notify the changes to all clients
m_aNotifier.notifyChanged(_anUpdate);
}
catch(configuration::Exception& ex)
{
+ CFG_TRACE_ERROR_NI("Got unexpected exception: %s", ex.what());
configapi::ExceptionMapper e(ex);
e.unhandled();
}
@@ -638,10 +665,13 @@ void CacheController::saveAndNotify(UpdateRequest const & _anUpdate) CFG_UNO_THR
void CacheController::flushPendingUpdates()
{
OSL_ASSERT(m_bDisposing);
+
if (m_pCacheWriter)
{
osl::MutexGuard aShotGuard(m_pCacheWriter->getShotMutex());
+ CFG_TRACE_INFO("CacheController: flushing all pending updates");
+
m_pCacheWriter->stopAndWriteCache();
}
}
@@ -685,30 +715,45 @@ bool CacheController::normalizeResult(NodeResult & _aResult, RequestOptions cons
NodeResult CacheController::loadDirectly(ComponentRequest const & _aRequest) CFG_UNO_THROW_ALL( )
{
+ CFG_TRACE_INFO("CacheController: loading data for component '%s' from the backend", OUSTRING2ASCII(_aRequest.getComponentName().toString()));
+
AbsolutePath aRequestPath = AbsolutePath::makeModulePath(_aRequest.getComponentName(), AbsolutePath::NoValidate());
NodeRequest aNodeRequest(aRequestPath, _aRequest.getOptions());
NodeResult aResult = m_xBackend->getNodeData(aNodeRequest);
+ CFG_TRACE_INFO_NI("- loading data completed - normalizing result");
+
if (!normalizeResult(aResult,_aRequest.getOptions()))
{
+ CFG_TRACE_ERROR_NI(" - cannot normalized result: failing");
+
OUString sMsg(RTL_CONSTASCII_USTRINGPARAM("Requested data at '"));
sMsg += aRequestPath.toString();
sMsg += OUString(RTL_CONSTASCII_USTRINGPARAM("'is not available: "));
throw com::sun::star::container::NoSuchElementException(sMsg,NULL);
}
+
+ CFG_TRACE_INFO_NI(" - returning normalized defaults");
+
return aResult;
}
// -----------------------------------------------------------------------------
NodeResult CacheController::loadDefaultsDirectly(NodeRequest const & _aRequest) CFG_UNO_THROW_ALL( )
{
+ CFG_TRACE_INFO("CacheController: loading defaults for '%s' from the backend", OUSTRING2ASCII(_aRequest.getPath().toString()));
+
NodeResult aResult = m_xBackend->getDefaultData(_aRequest);
+ CFG_TRACE_INFO_NI("- loading defaultscompleted - normalizing result");
+
normalizeResult(aResult,_aRequest.getOptions());
+ CFG_TRACE_INFO_NI(" - returning normalized defaults");
+
return aResult;
}
// -----------------------------------------------------------------------------
@@ -725,6 +770,8 @@ void CacheController::savePendingChanges(CacheRef const & _aCache, ComponentRequ
try
{
+ CFG_TRACE_INFO("CacheController: saving updates for tree: '%s'", OUSTRING2ASCII(_aComponent.getComponentName().toString()));
+
std::auto_ptr<SubtreeChange> aChangeData = _aCache->releasePendingChanges(_aComponent.getComponentName());
if (aChangeData.get())
@@ -738,24 +785,30 @@ void CacheController::savePendingChanges(CacheRef const & _aCache, ComponentRequ
// anUpdateSpec.setRequestId(pInfo->getRequestId(_aRootPath));
this->saveDirectly(anUpdateSpec);
+
+ CFG_TRACE_INFO_NI("- saving changes completed successfully");
}
else
CFG_TRACE_WARNING_NI("- no changes found - cannot save");
}
catch(uno::Exception& e)
{
- CFG_TRACE_ERROR_NI("CacheController: saving failed: %s", OUSTRING2ASCII(e.Message));
+ CFG_TRACE_ERROR_NI("CacheController: saving tree '%s' failed: %s",
+ OUSTRING2ASCII(_aComponent.getComponentName().toString()),
+ OUSTRING2ASCII(e.Message) );
this->invalidateComponent(_aComponent);
+ CFG_TRACE_INFO_NI("- component data invalidated");
throw;
}
}
// -----------------------------------------------------------------------------
-void CacheController::saveAllPendingChanges(CacheRef const & _aCache, RequestOptions const & _aOptions)
- CFG_UNO_THROW_ALL( )
+bool CacheController::saveAllPendingChanges(CacheRef const & _aCache, RequestOptions const & _aOptions)
+ CFG_UNO_THROW_RTE( )
{
+ CFG_TRACE_INFO("CacheController: Saving all pending changes for cache line");
OSL_ASSERT(_aCache.is());
typedef Cache::Data::PendingModuleList PMList;
@@ -763,12 +816,26 @@ void CacheController::saveAllPendingChanges(CacheRef const & _aCache, RequestOpt
PMList aPendingModules;
_aCache->findPendingChangedModules(aPendingModules);
+ CFG_TRACE_INFO_NI("Found %d changed modules",int(aPendingModules.size()));
+
+ bool bSuccess = true;
for (PMList::iterator it = aPendingModules.begin();
it != aPendingModules.end();
++it )
{
- this->savePendingChanges(_aCache, ComponentRequest(*it,_aOptions) );
+ try
+ {
+ this->savePendingChanges(_aCache, ComponentRequest(*it,_aOptions) );
+ }
+ catch (uno::Exception & )
+ {
+ CFG_TRACE_ERROR_NI("CacheController: Exception while saving one module - ignoring");
+ bSuccess = false;
+ }
}
+ CFG_TRACE_INFO_NI("Done saving pending changes for cache line");
+
+ return bSuccess;
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
diff --git a/configmgr/source/treecache/cachecontroller.hxx b/configmgr/source/treecache/cachecontroller.hxx
index 456a5f1219e7..40de327c1d64 100644
--- a/configmgr/source/treecache/cachecontroller.hxx
+++ b/configmgr/source/treecache/cachecontroller.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: cachecontroller.hxx,v $
*
- * $Revision: 1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: jb $ $Date: 2002-03-28 09:06:57 $
+ * last change: $Author: jb $ $Date: 2002-07-12 11:42:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -326,8 +326,8 @@ namespace configmgr
void savePendingChanges(CacheRef const & _aCache, ComponentRequest const & _aComponent)
CFG_UNO_THROW_ALL( );
// saves all pending changes from a cache access to the backend
- void saveAllPendingChanges(CacheRef const & _aCache, RequestOptions const & _aOptions)
- CFG_UNO_THROW_ALL( );
+ bool saveAllPendingChanges(CacheRef const & _aCache, RequestOptions const & _aOptions)
+ CFG_UNO_THROW_RTE( );
CacheRef getCacheAlways(RequestOptions const & _aOptions);
@@ -338,7 +338,7 @@ namespace configmgr
void flushPendingUpdates();
// disposing
- void disposeAll();
+ void disposeAll(bool _bFlushRemainingUpdates);
void disposeOne(RequestOptions const & _aOptions, bool _bFlushUpdates = true);
void disposeUser(RequestOptions const & _aUserOptions, bool _bFlushUpdates = true);
void implDisposeOne(CacheRef const & _aCache, RequestOptions const & _aOptions, bool _bFlushUpdates);
diff --git a/configmgr/source/treecache/cachewritescheduler.cxx b/configmgr/source/treecache/cachewritescheduler.cxx
index affded75fec0..0b844cb71f58 100644
--- a/configmgr/source/treecache/cachewritescheduler.cxx
+++ b/configmgr/source/treecache/cachewritescheduler.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: cachewritescheduler.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: jb $ $Date: 2002-03-28 09:08:05 $
+ * last change: $Author: jb $ $Date: 2002-07-12 11:42:49 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -93,6 +93,9 @@ void OCacheWriteScheduler::stopAndWriteCache()
aOwnGuard.clear();
runWriter();
+
+ osl::MutexGuard aClearGuard( m_aMutex );
+ m_aWriteList.clear();
}
// -------------------------------------------------------------------------
@@ -101,6 +104,12 @@ void OCacheWriteScheduler::Timer::onShot()
osl::MutexGuard aGuard(m_aMutex);
if (pParent)
pParent->onTimerShot();
+
+ else
+ {
+ CFG_TRACE_WARNING("Timer shot for disposed cache writer");
+ }
+
}
// -----------------------------------------------------------------------------
@@ -108,14 +117,16 @@ void OCacheWriteScheduler::onTimerShot()
{
//m_aTimer.stop();
- CFG_TRACE_INFO("Cleanup Timer invoked - executing dispose task");
+ CFG_TRACE_INFO("Write Timer invoked - executing write task");
try
{
runWriter();
+ CFG_TRACE_INFO_NI("Write timer: writing ended");
}
catch (...)
{
+ CFG_TRACE_ERROR_NI("Write timer: writing failed with an unknown exception");
OSL_ENSURE(false, "ERROR: Unknown Exception left a writer");
}
@@ -128,43 +139,62 @@ void OCacheWriteScheduler::onTimerShot()
void OCacheWriteScheduler::runWriter()
{
// Write Cache
- CFG_TRACE_INFO("Starting lazy write");
+ CFG_TRACE_INFO("Running write operations");
// osl::ClearableMutexGuard aGuard( m_rTreeManager.m_aUpdateMutex );
- for (CacheWriteList::iterator it = m_aWriteList.begin();
- it != m_aWriteList.end();
- )
+ osl::ClearableMutexGuard aListGuard( m_aMutex );
+ CacheWriteList aPendingWrites;
+ m_aWriteList.swap(aPendingWrites);
+ aListGuard.clear();
+
+ CFG_TRACE_INFO_NI("Found %d sections to write", int(aPendingWrites.size()));
+ for (CacheWriteList::iterator it = aPendingWrites.begin();
+ it != aPendingWrites.end();
+ ++it)
{
RequestOptions aTaskOption = *it;
- ++it; // advance iterator now - writeOneTree.. may erase current element
try
{
writeOneTreeFoundByOption(aTaskOption);
}
catch (uno::Exception& e)
{
- CFG_TRACE_ERROR("TreeCacheWriteScheduler: Attempt to write data failed - error is '%s' (currently ignored)",OUSTRING2ASCII(e.Message));
+ CFG_TRACE_ERROR_NI("TreeCacheWriteScheduler: Attempt to write data failed - error is '%s' (currently ignored)",OUSTRING2ASCII(e.Message));
}
}
// m_aWriteList.clear();
+ CFG_TRACE_INFO_NI("DONE: Running write operations");
}
// -----------------------------------------------------------------------------
void OCacheWriteScheduler::writeOneTreeFoundByOption(RequestOptions const& _aOptions) CFG_UNO_THROW_ALL( )
{
+ CFG_TRACE_INFO("Writeing one cache tree for user '%s' with locale '%s'",
+ OUSTRING2ASCII(_aOptions.getEntity()),
+ OUSTRING2ASCII(_aOptions.getLocale()));
+
// PRE: m_aUpdateMutex of TreeMgr must be acuired
CacheManager::CacheRef aCache = m_rTreeManager.m_aCacheList.get(_aOptions);
if (aCache.is())
{
CFG_TRACE_INFO_NI("- Found matching data container - starting write task");
- m_rTreeManager.saveAllPendingChanges(aCache,_aOptions);
+ if (m_rTreeManager.saveAllPendingChanges(aCache,_aOptions))
+ {
+ osl::MutexGuard aListGuard( m_aMutex );
+ m_aWriteList.insert(_aOptions);
+
+ CFG_TRACE_INFO_NI("- Write task incomplete -reregistering");
+ }
// we got a pending list with pointers from TreeInfo.
}
else
{
CFG_TRACE_WARNING_NI("- Data container (TreeInfo) to write not found: Ignoring task");
}
- m_aWriteList.erase(_aOptions);
+
+ CFG_TRACE_INFO_NI("Removing written cache tree (for user '%s' with locale '%s')",
+ OUSTRING2ASCII(_aOptions.getEntity()),
+ OUSTRING2ASCII(_aOptions.getLocale()));
}
// -----------------------------------------------------------------------------
@@ -174,6 +204,12 @@ bool OCacheWriteScheduler::clearTasks(RequestOptions const& _aOptions)
// sadly list::remove doesn't return an indication of what it did
bool bFound = m_aWriteList.erase(_aOptions) !=0;
+ if (bFound)
+ {
+ CFG_TRACE_INFO("Write Scheduler: Dropped cache tree (for user '%s' with locale '%s') from task list",
+ OUSTRING2ASCII(_aOptions.getEntity()),
+ OUSTRING2ASCII(_aOptions.getLocale()));
+ }
return bFound;
}
@@ -182,6 +218,7 @@ bool OCacheWriteScheduler::clearTasks(RequestOptions const& _aOptions)
// should be called guarded only
void OCacheWriteScheduler::implStartBefore(TimeStamp const& _aTime)
{
+ CFG_TRACE_INFO("Triggering write timer");
// check if we were cleared
if (!m_aWriteList.empty())
{
@@ -194,13 +231,13 @@ void OCacheWriteScheduler::implStartBefore(TimeStamp const& _aTime)
OSL_ASSERT( m_xTimer->isTicking() );
}
- CFG_TRACE_INFO_NI("- Cleanup timer running - next execution in %d seconds", int (m_xTimer->getRemainingTime().Seconds) );
- CFG_TRACE_INFO_NI("- %d cleanup tasks are pending", int(m_aWriteList.size()) );
+ CFG_TRACE_INFO_NI("- Write timer running - next execution in %d seconds", int (m_xTimer->getRemainingTime().Seconds) );
+ CFG_TRACE_INFO_NI("- %d write tasks are pending", int(m_aWriteList.size()) );
}
else
{
m_xTimer->stop();
- CFG_TRACE_INFO_NI("- Stopped timer - no more open cleanup tasks");
+ CFG_TRACE_INFO_NI("- Stopped timer - no more open write tasks");
}
}
@@ -221,8 +258,6 @@ void OCacheWriteScheduler::scheduleWrite(backend::ComponentRequest _aComponent)
TimeStamp aNewTime = implGetScheduleTime(TimeStamp::getCurrentTime(), m_aWriteInterval);
implStartBefore(aNewTime);
-
- CFG_TRACE_INFO_NI("- cache write will be started in about %d seconds", int(m_aWriteInterval.getTimeValue().Seconds));
}
// -----------------------------------------------------------------------------
diff --git a/configmgr/source/treecache/treemanager.cxx b/configmgr/source/treecache/treemanager.cxx
index 3b638fc32a80..b978d5f3139d 100644
--- a/configmgr/source/treecache/treemanager.cxx
+++ b/configmgr/source/treecache/treemanager.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: treemanager.cxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: jb $ $Date: 2002-03-28 18:01:35 $
+ * last change: $Author: jb $ $Date: 2002-07-12 11:42:50 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -311,7 +311,7 @@ data::NodeAccess TreeManager::requestSubtree(AbsolutePath const& aSubtreePath,
const vos::ORef < OOptions >& _xOptions,
sal_Int16 nMinLevels) CFG_UNO_THROW_ALL( )
{
- CFG_TRACE_INFO("cache manager: checking the cache");
+ CFG_TRACE_INFO("TreeManager: request for subtree '%s'", OUSTRING2ASCII(aSubtreePath.toString()));
CacheRef aCache = getCacheAlways(_xOptions->getRequestOptions());
OSL_ENSURE(aCache.is(),"TreeManager: Cannot create cache access for loading node");
@@ -320,20 +320,25 @@ data::NodeAccess TreeManager::requestSubtree(AbsolutePath const& aSubtreePath,
if (!aCache->hasModule(aSubtreePath))
{
- CFG_TRACE_INFO_NI("cache manager: cache miss. going to load the node");
+ CFG_TRACE_INFO_NI("TreeManager: cache miss. going to load the node");
backend::ComponentRequest aQuery( aSubtreePath.getModuleName(), _xOptions->getRequestOptions() );
backend::CacheLocation aLoadedLocation = m_xCacheLoader->loadComponent(aQuery);
if (aLoadedLocation.isNull())
+ {
+ CFG_TRACE_WARNING_NI("TreeManager: requested component not found");
throw com::sun::star::container::
NoSuchElementException( MAKEUSTRING("Requested component not found"), NULL);
+ }
+
+ CFG_TRACE_INFO_NI("TreeManager: attaching loaded cache segment ");
aAccessor = data::Accessor(aCache->attachDataSegment(aLoadedLocation.segment,aSubtreePath));
OSL_ENSURE(aAccessor.is(),"Cannot attach to loaded component");
}
else
{
- CFG_TRACE_INFO_NI("cache manager: found node in cache");
+ CFG_TRACE_INFO_NI("TreeManager: found node in cache");
OSL_ENSURE(_xOptions->canUseCache(),"TreeManager: Found node in cache for non-cachable request");
aAccessor = data::Accessor(aCache->getDataSegment(aSubtreePath));
@@ -369,7 +374,7 @@ sal_Bool TreeManager::fetchDefaultData( memory::UpdateAccessor& _aAccessToken,
if (aCache->hasModuleDefaults(_aAccessToken.accessor(),aSubtreePath))
{
- CFG_TRACE_INFO_NI("cache manager: found default data in cache");
+ CFG_TRACE_INFO_NI("TreeManager: found default data in cache");
return true;
}
@@ -381,11 +386,12 @@ sal_Bool TreeManager::fetchDefaultData( memory::UpdateAccessor& _aAccessToken,
if (!aDefaults.is())
{
+ CFG_TRACE_INFO_NI("TreeManager: merging loaded defaults into cache");
return aCache->insertDefaults(_aAccessToken,aDefaults.instance());
}
else
{
- CFG_TRACE_WARNING_NI("cache manager: cannot load defaults: no data available or not supported");
+ CFG_TRACE_WARNING_NI("TreeManager: cannot load defaults: no data available or not supported");
return false;
}
}
@@ -396,6 +402,7 @@ std::auto_ptr<ISubtree> TreeManager::requestDefaultData(AbsolutePath const& aSub
sal_Int16 nMinLevels) CFG_UNO_THROW_ALL( )
{
// to do: check cache for existing default data (?!)
+ CFG_TRACE_INFO_NI("TreeManager: loading default data directly");
backend::NodeRequest aRequest(aSubtreePath,_xOptions->getRequestOptions());
@@ -429,7 +436,7 @@ data::TreeAccessor TreeManager::requestTemplate(data::Accessor const& /*_aSource
{
OSL_ENSURE(!_rName.isEmpty(), "TreeManager::requestTemplate : invalid template name !");
- CFG_TRACE_INFO("tree manager: going to get a template named %s", OUSTRING2ASCII(_rName.toString()));
+ CFG_TRACE_INFO("TreeManager: going to get a template named %s", OUSTRING2ASCII(_rName.toString()));
AbsolutePath aTemplateLocation = encodeTemplateLocation(_rName, _rModule);
Name aCacheModule = aTemplateLocation.getModuleName();
@@ -442,13 +449,18 @@ data::TreeAccessor TreeManager::requestTemplate(data::Accessor const& /*_aSource
{
aTemplatesAccessor.clear();
- CFG_TRACE_INFO_NI("tree manager: cache miss. going to load the template");
+ CFG_TRACE_INFO_NI("TreeManager: cache miss. going to load the template");
backend::TemplateRequest aQuery( _rName, _rModule );
backend::CacheLocation aLoadedLocation = m_xCacheLoader->loadTemplate(aQuery);
if (aLoadedLocation.isNull())
+ {
+ CFG_TRACE_ERROR_NI("TreeManager: requested template module not found");
throw com::sun::star::container::
NoSuchElementException( MAKEUSTRING("Requested template module not found"), NULL);
+ }
+
+ CFG_TRACE_INFO_NI("TreeManager: attaching to loaded template module");
aTemplatesAccessor = data::Accessor(getTemplates().attachDataSegment(aLoadedLocation.segment,aCacheModule));
OSL_ENSURE(aTemplatesAccessor.is(),"Cannot attach to loaded component");
@@ -458,14 +470,17 @@ data::TreeAccessor TreeManager::requestTemplate(data::Accessor const& /*_aSource
}
else
{
+ CFG_TRACE_INFO_NI("TreeManager: template module found in cache");
OSL_ENSURE(aTemplatesAccessor.is(),"No accessor for existing data ?");
}
data::TreeAddress aTemplateAddr = getTemplates().getTemplateTree(aTemplatesAccessor,aTemplateLocation);
if (aTemplateAddr.isNull())
+ {
+ CFG_TRACE_ERROR_NI("TreeManager: template not found in module");
throw com::sun::star::container::
NoSuchElementException( MAKEUSTRING("Unknown template. Type description could not be found in the given module."), NULL);
-
+ }
return data::TreeAccessor(aTemplatesAccessor,aTemplateAddr);
}
@@ -473,12 +488,14 @@ data::TreeAccessor TreeManager::requestTemplate(data::Accessor const& /*_aSource
void TreeManager::saveAndNotifyUpdate(data::Accessor const& _aChangedDataAccessor, TreeChangeList const& aChangeTree) CFG_UNO_THROW_ALL( )
{
{
+ CFG_TRACE_INFO("TreeManager: committing an Update to the cache controller");
backend::UpdateRequest anUpdate(
& aChangeTree.root,
aChangeTree.getRootNodePath(),
aChangeTree.getOptions()->getRequestOptions());
m_xCacheLoader->saveAndNotify(anUpdate);
+ CFG_TRACE_INFO_NI("TreeManager: committing done");
}
// notification should be done via the cache loader
@@ -488,13 +505,14 @@ void TreeManager::saveAndNotifyUpdate(data::Accessor const& _aChangedDataAccesso
// -------------------------------------------------------------------------
void TreeManager::fireChanges(data::Accessor const& _aChangedDataAccessor, TreeChangeList const& aChangeTree, sal_Bool _bError)
{
+ CFG_TRACE_INFO("TreeManager: broadcasting changes");
ConfigChangeBroadcaster::fireChanges(_aChangedDataAccessor, aChangeTree, _bError);
}
// -----------------------------------------------------------------------------
void TreeManager::updateTree(memory::UpdateAccessor& _aAccessToken, TreeChangeList& _aChanges) CFG_UNO_THROW_ALL( )
{
- CFG_TRACE_INFO("tree manager: updating the tree from a changes list");
+ CFG_TRACE_INFO("TreeManager: updating the cache from a changes list");
// normalize the update tree. This means that we want a tree with one root which has either more than one child
#if 0 // try without the normalization
@@ -528,12 +546,15 @@ void TreeManager::updateTree(memory::UpdateAccessor& _aAccessToken, TreeChangeLi
if (!aCache.is())
{
+ CFG_TRACE_ERROR_NI("TreeManager: Cache access to update into does not exist !");
OSL_ENSURE(aCache.is(),"TreeManager: Cache access to update into does not exist ! Where does the update access come from ?");
throw lang::DisposedException(OUString::createFromAscii("Tree to be updated was already disposed"), NULL);
}
// merge the changes into the tree
aCache->applyUpdate(_aAccessToken, anUpdate);
+
+ CFG_TRACE_INFO_NI("TreeManager: cache update done");
}
// -----------------------------------------------------------------------------
@@ -561,20 +582,22 @@ void TreeManager::releaseSubtree( AbsolutePath const& aSubtreePath, const vos::O
//-----------------------------------------------------------------------------
void TreeManager::disposeData(const vos::ORef < OOptions >& _xOptions) CFG_NOTHROW()
{
+ CFG_TRACE_INFO("TreeManager: disposing data by options");
+
OSL_ENSURE(!_xOptions.isEmpty(), "TreeManager: Cannot dispose: NULL options are not permitted");
if (_xOptions.isEmpty()) return;
if (_xOptions->getLocale().getLength() != 0)
{
OSL_ENSURE(_xOptions->getUser().getLength() != 0, "TreeManager: Cannot dispose locale without user");
- CFG_TRACE_INFO( "TreeManager: Disposing data for options: USER='%s' and LOCALE = '%s'",
- OUSTRING2ASCII(_xOptions->getUser()), OUSTRING2ASCII(_xOptions->getLocale()) );
+ CFG_TRACE_INFO_NI( "TreeManager: Disposing data for options: USER='%s' and LOCALE = '%s'",
+ OUSTRING2ASCII(_xOptions->getUser()), OUSTRING2ASCII(_xOptions->getLocale()) );
this->disposeOne( _xOptions->getRequestOptions() );
}
else if (_xOptions->getUser().getLength() != 0)
{
- CFG_TRACE_INFO( "TreeManager: Disposing data for user: '%s'", OUSTRING2ASCII(_xOptions->getUser()) );
+ CFG_TRACE_INFO_NI( "TreeManager: Disposing data for user: '%s'", OUSTRING2ASCII(_xOptions->getUser()) );
this->disposeUser(_xOptions->getRequestOptions() );
}
@@ -582,13 +605,14 @@ void TreeManager::disposeData(const vos::ORef < OOptions >& _xOptions) CFG_NOTHR
{
OSL_ENSURE(false, "TreeManager: Cannot dispose: neither user nor locale specified in options");
}
+ CFG_TRACE_INFO_NI("TreeManager: disposing data done");
}
// INotifyListener
// ----------------------------------------------------------------------------
void TreeManager::nodeUpdated(TreeChangeList& _rChanges)
{
- CFG_TRACE_INFO("cache manager: updating the tree from a notification");
+ CFG_TRACE_INFO("TreeManager: nodeUpdated");
try
{
CacheRef aCache = m_aCacheList.get(_rChanges.getOptions()->getRequestOptions());
@@ -610,8 +634,9 @@ void TreeManager::nodeUpdated(TreeChangeList& _rChanges)
}
catch (uno::RuntimeException&)
{
- CFG_TRACE_ERROR("TreeManager::nodeUpdated : could not notify !");
+ CFG_TRACE_ERROR_NI("TreeManager::nodeUpdated : could not notify !");
}
+ CFG_TRACE_INFO_NI("TreeManager: nodeUpdated done");
}
// ----------------------------------------------------------------------------
@@ -621,12 +646,14 @@ void TreeManager::nodeUpdated(TreeChangeList& _rChanges)
void TreeManager::disposing(backend::ICachedDataProvider & _rProvider) CFG_NOTHROW()
{
+ CFG_TRACE_INFO("TreeManager: provider is being disposed");
this->dispose();
}
// ----------------------------------------------------------------------------
void TreeManager::componentCreated(backend::ComponentRequest const & ) CFG_NOTHROW()
{
+ CFG_TRACE_INFO("TreeManager: component was created");
}
// ----------------------------------------------------------------------------