From 612f04376ea27756c44a058f9512aaf2a3c095b9 Mon Sep 17 00:00:00 2001 From: Matthew Newhook Date: Tue, 4 Sep 2007 17:27:59 +0800 Subject: http://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=2451 Squashed commit of the following: commit f4ba9698ababcd06659be2c941fb1809833764ee Author: Matthew Newhook Date: Tue Sep 4 17:25:35 2007 +0800 some cleanup. commit 58dae2c8e42132d645e8cbfce7ac6856995d3241 Author: Matthew Newhook Date: Tue Sep 4 17:20:22 2007 +0800 added more dire warning comments. commit c95d285943268c3623d61ccae8cc4d4654cf8056 Author: Matthew Newhook Date: Tue Sep 4 17:09:32 2007 +0800 remove debug. added comment. commit 8eed648a285edcf6b256ca9195021e36e437ac36 Author: Matthew Newhook Date: Tue Sep 4 17:04:12 2007 +0800 Copy the connection to prevent the transaction from accessing itself after its been blown away. commit 08523da6819abf029f67178a51c09b39e41168ca Author: Matthew Newhook Date: Tue Sep 4 16:25:40 2007 +0800 first set of fixes for the reference counting. --- cpp/src/Freeze/SharedDbEnv.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'cpp/src/Freeze/SharedDbEnv.cpp') diff --git a/cpp/src/Freeze/SharedDbEnv.cpp b/cpp/src/Freeze/SharedDbEnv.cpp index 1c54afbce7c..39df230f32c 100644 --- a/cpp/src/Freeze/SharedDbEnv.cpp +++ b/cpp/src/Freeze/SharedDbEnv.cpp @@ -90,10 +90,8 @@ SharedDbEnvMap* sharedDbEnvMap; } - Freeze::SharedDbEnvPtr -Freeze::SharedDbEnv::get(const CommunicatorPtr& communicator, - const string& envName, DbEnv* env) +Freeze::SharedDbEnv::get(const CommunicatorPtr& communicator, const string& envName, DbEnv* env) { StaticMutex::Lock lock(_mapMutex); @@ -243,7 +241,6 @@ Freeze::SharedDbEnv::createCurrent() return ctx; } - Freeze::TransactionalEvictorContextPtr Freeze::SharedDbEnv::getCurrent() { @@ -275,19 +272,19 @@ Freeze::SharedDbEnv::setCurrentTransaction(const Freeze::TransactionPtr& tx) // // Verify it points to the good DbEnv // - if(txi->getConnectionI() == 0 || txi->getConnectionI()->dbEnv() == 0) + ConnectionIPtr conn = ConnectionIPtr::dynamicCast(tx->getConnection()); + if(!conn || conn->dbEnv() == 0) { throw DatabaseException(__FILE__, __LINE__, "invalid transaction"); } - if(txi->getConnectionI()->dbEnv().get() != this) + if(conn->dbEnv().get() != this) { throw DatabaseException(__FILE__, __LINE__, "the given transaction is bound to environment '" + - txi->getConnectionI()->dbEnv()->_envName + "'"); + conn->dbEnv()->_envName + "'"); } } - Freeze::TransactionalEvictorContextPtr ctx = getCurrent(); if(ctx != 0) @@ -457,8 +454,6 @@ Freeze::SharedDbEnv::SharedDbEnv(const std::string& envName, _catalog = SharedDb::openCatalog(*this); } - - Freeze::CheckpointThread::CheckpointThread(SharedDbEnv& dbEnv, const Time& checkpointPeriod, Int kbyte, Int trace) : _dbEnv(dbEnv), _done(false), @@ -481,7 +476,6 @@ Freeze::CheckpointThread::terminate() getThreadControl().join(); } - void Freeze::CheckpointThread::run() { -- cgit v1.2.3