summaryrefslogtreecommitdiff
path: root/configmgr
diff options
context:
space:
mode:
authorLars Langhans <lla@openoffice.org>2001-01-26 06:53:36 +0000
committerLars Langhans <lla@openoffice.org>2001-01-26 06:53:36 +0000
commite87893363966a8478d93fcfa9da41b0be96a6bf3 (patch)
treebe1cdd7bb060205939f975748ba0bf8cef9c538a /configmgr
parentd234e6e26a00e8d93fee5e46ad9b0bc3416c6921 (diff)
#82734# lasy writing
Diffstat (limited to 'configmgr')
-rw-r--r--configmgr/source/inc/options.hxx11
-rw-r--r--configmgr/source/inc/treeprovider.hxx14
-rw-r--r--configmgr/source/treecache/disposetimer.cxx67
-rw-r--r--configmgr/source/treecache/disposetimer.hxx6
4 files changed, 44 insertions, 54 deletions
diff --git a/configmgr/source/inc/options.hxx b/configmgr/source/inc/options.hxx
index d7c01196739e..083892be67c9 100644
--- a/configmgr/source/inc/options.hxx
+++ b/configmgr/source/inc/options.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: options.hxx,v $
*
- * $Revision: 1.7 $
+ * $Revision: 1.8 $
*
- * last change: $Author: dg $ $Date: 2000-12-19 13:47:31 $
+ * last change: $Author: lla $ $Date: 2001-01-26 07:53:36 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -98,10 +98,12 @@ namespace configmgr
rtl::OUString m_sUser; // user key used (could be empty)
rtl::OUString m_sDefaultUser; // user key used (could be empty)
sal_Int32 m_nCacheID; // set if data should not be fetched from the cache, but reloaded
+ bool m_bLasyWrite; // true, if tree use lasy writing
public:
OOptions(const uno::Reference< script::XTypeConverter >& _xConverter)
:m_xConverter(_xConverter)
,m_nCacheID(0)
+ ,m_bLasyWrite(false)
{}
OOptions(const OOptions& _rOptions)
@@ -110,7 +112,8 @@ namespace configmgr
,m_sDefaultUser(_rOptions.getDefaultUser())
,m_sLocale(_rOptions.m_sLocale)
,m_sUser(_rOptions.m_sUser)
- ,m_nCacheID(0) // cache identity is not copied
+ ,m_nCacheID(0), // cache identity is not copied
+ m_bLasyWrite(_rOptions.m_bLasyWrite)
{
if (!_rOptions.canUseCache()) this->setNoCache();
}
@@ -132,6 +135,8 @@ namespace configmgr
void setDefaultUser(const rtl::OUString& _rUser) {m_sDefaultUser = _rUser;}
void setLocale(const rtl::OUString& _rLocale) {m_sLocale = _rLocale;}
void setDefaultLocale(const rtl::OUString& _rLocale) {m_sDefaultLocale = _rLocale;}
+ void setLasyWrite(bool _bLasyWrite = false) {m_bLasyWrite = _bLasyWrite;}
+ bool getLasyWrite() {return m_bLasyWrite;}
friend sal_Int32 compareCacheIdentity(OOptions const& lhs, OOptions const& rhs)
{ return rhs.m_nCacheID - lhs.m_nCacheID; }
diff --git a/configmgr/source/inc/treeprovider.hxx b/configmgr/source/inc/treeprovider.hxx
index a41f06d3f25f..ce800b0dfc4c 100644
--- a/configmgr/source/inc/treeprovider.hxx
+++ b/configmgr/source/inc/treeprovider.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: treeprovider.hxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: lla $ $Date: 2001-01-17 15:02:30 $
+ * last change: $Author: lla $ $Date: 2001-01-26 07:53:36 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -135,11 +135,11 @@ namespace configmgr
root(_aSubtree) /* EXPENSIVE!!! (deep copy) */
{}
- TreeChangeList(const vos::ORef < OOptions >& _xOptions, const rtl::OUString& _rPathToRoot, auto_ptr<SubtreeChange> _pSubtreeChange)
- : m_xOptions(_xOptions),
- pathToRoot(_rPathToRoot),
- root(*_pSubtreeChange.release()) /* EXPENSIVE!!! (deep copy) */
- {}
+ // TreeChangeList(const vos::ORef < OOptions >& _xOptions, const rtl::OUString& _rPathToRoot, auto_ptr<SubtreeChange> _pSubtreeChange)
+ // : m_xOptions(_xOptions),
+ // pathToRoot(_rPathToRoot),
+ // root(*_pSubtreeChange.release()) /* EXPENSIVE!!! (deep copy) */
+ // {}
/** ctor
@param _rPathToRoot path to the root of the whole to-be-updated subtree
@param _rLocalName relative path within the to-be-updated subtree
diff --git a/configmgr/source/treecache/disposetimer.cxx b/configmgr/source/treecache/disposetimer.cxx
index c3cdbee31a49..4e45a4b407a5 100644
--- a/configmgr/source/treecache/disposetimer.cxx
+++ b/configmgr/source/treecache/disposetimer.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: disposetimer.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: lla $ $Date: 2001-01-18 13:18:40 $
+ * last change: $Author: lla $ $Date: 2001-01-26 07:51:57 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -417,17 +417,6 @@ void OTreeCacheWriteScheduler::onTimerShot()
{
runDisposer();
}
-
- catch (uno::Exception& ue)
- {
- OSL_ENSURE(false, "ERROR: UNO Exception left a disposer");
- ue;
- }
- catch (configuration::Exception& ce)
- {
- OSL_ENSURE(false, "ERROR: configuration::Exception left a disposer");
- ce;
- }
catch (...)
{
OSL_ENSURE(false, "ERROR: Unknown Exception left a disposer");
@@ -452,35 +441,32 @@ void OTreeCacheWriteScheduler::runDisposer()
vos::ORef< OOptions > xTaskOption = *it;
if (xTaskOption.isValid())
{
- if (TreeInfo* pInfo = m_rTreeManager.requestTreeInfo(xTaskOption,false))
+ sal_Int32 nErrorCount = writeOneTreeFoundByOption(xTaskOption);
+ if (nErrorCount == 0)
{
- CFG_TRACE_INFO_NI("- Found matching data container (TreeInfo) - collecting data");
-
- PendingList aList;
- sal_Int32 nCount = pInfo->syncPending(xTaskOption, aList);
- if (nCount > 0)
- {
- CFG_TRACE_INFO_NI("write down %d pendings", nCount);
- for(PendingList::iterator it = aList.begin();
- it != aList.end();
- ++it)
- {
- rtl::OUString sName = it->first;
- // LLA->JB: Is this a hack?
- auto_ptr<SubtreeChange> aSubtreeChange = auto_ptr<SubtreeChange>(it->second);
- ConfigurationName aName; // MUST be empty, we have the ptr to the root obj
- m_rTreeManager.sessionUpdate(xTaskOption, aName, aSubtreeChange);
- }
- }
+ it = m_aWriteList.erase(it);
}
}
else
{
CFG_TRACE_WARNING_NI("runDisposer: TaskOption not valid");
}
+ }
+ // m_aWriteList.clear();
+}
+
+// -----------------------------------------------------------------------------
+sal_Int32 OTreeCacheWriteScheduler::writeOneTreeFoundByOption(vos::ORef< OOptions > const& _xOptions)
+{
+ sal_Int32 nErrorCount = 0;
+ if (TreeInfo* pInfo = m_rTreeManager.requestTreeInfo(_xOptions,false))
+ {
+ CFG_TRACE_INFO_NI("- Found matching data container (TreeInfo) - collecting data");
+ nErrorCount = pInfo->syncPending(_xOptions, m_rTreeManager);
+ // we got a pending list with pointers from TreeInfo.
}
- m_aWriteList.clear();
+ return nErrorCount;
}
// -----------------------------------------------------------------------------
@@ -528,20 +514,19 @@ void OTreeCacheWriteScheduler::scheduleWrite(vos::ORef< OOptions > const& _xOpti
CFG_TRACE_INFO_NI("- cache write will be started in about %d seconds", int(m_aCleanupInterval.getTimeValue().Seconds));
- m_aWriteList.push_back(_xOptions);
-
-
if (_bSync || m_bSyncron)
{
- // write now!
- runDisposer();
- }
- else
- {
// lasy writing
+ m_aWriteList.push_back(_xOptions);
+
TimeStamp aNewTime = implGetCleanupTime(TimeStamp::getCurrentTime(), m_aCleanupInterval);
implStartBefore(aNewTime);
}
+ else
+ {
+ // write now!
+ writeOneTreeFoundByOption(_xOptions);
+ }
}
} // namespace
diff --git a/configmgr/source/treecache/disposetimer.hxx b/configmgr/source/treecache/disposetimer.hxx
index f597526a523a..7d5e48d823bf 100644
--- a/configmgr/source/treecache/disposetimer.hxx
+++ b/configmgr/source/treecache/disposetimer.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: disposetimer.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: lla $ $Date: 2001-01-17 15:02:34 $
+ * last change: $Author: lla $ $Date: 2001-01-26 07:51:57 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -262,7 +262,7 @@ namespace configmgr
void runDisposer();
void implStartBefore(TimeStamp const& _aTime);
-
+ sal_Int32 writeOneTreeFoundByOption(vos::ORef< OOptions > const& _xOption);
};
////////////////////////////////////////////////////////////////////////////////
} // namespace configmgr