summaryrefslogtreecommitdiff
path: root/cpp/src/Freeze/ConnectionI.cpp
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2007-09-04 17:27:59 +0800
committerMatthew Newhook <matthew@zeroc.com>2007-09-04 17:27:59 +0800
commit612f04376ea27756c44a058f9512aaf2a3c095b9 (patch)
tree403163cec5182251a080f9a795d4c73d4f2f1e9d /cpp/src/Freeze/ConnectionI.cpp
parentfix bug with test/Slice/keyword/run.py (diff)
downloadice-612f04376ea27756c44a058f9512aaf2a3c095b9.tar.bz2
ice-612f04376ea27756c44a058f9512aaf2a3c095b9.tar.xz
ice-612f04376ea27756c44a058f9512aaf2a3c095b9.zip
http://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=2451
Squashed commit of the following: commit f4ba9698ababcd06659be2c941fb1809833764ee Author: Matthew Newhook <matthew@zeroc.com> Date: Tue Sep 4 17:25:35 2007 +0800 some cleanup. commit 58dae2c8e42132d645e8cbfce7ac6856995d3241 Author: Matthew Newhook <matthew@zeroc.com> Date: Tue Sep 4 17:20:22 2007 +0800 added more dire warning comments. commit c95d285943268c3623d61ccae8cc4d4654cf8056 Author: Matthew Newhook <matthew@zeroc.com> Date: Tue Sep 4 17:09:32 2007 +0800 remove debug. added comment. commit 8eed648a285edcf6b256ca9195021e36e437ac36 Author: Matthew Newhook <matthew@zeroc.com> 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 <matthew@zeroc.com> Date: Tue Sep 4 16:25:40 2007 +0800 first set of fixes for the reference counting.
Diffstat (limited to 'cpp/src/Freeze/ConnectionI.cpp')
-rw-r--r--cpp/src/Freeze/ConnectionI.cpp19
1 files changed, 5 insertions, 14 deletions
diff --git a/cpp/src/Freeze/ConnectionI.cpp b/cpp/src/Freeze/ConnectionI.cpp
index 1237a46c753..66a1e8ba0f7 100644
--- a/cpp/src/Freeze/ConnectionI.cpp
+++ b/cpp/src/Freeze/ConnectionI.cpp
@@ -15,7 +15,6 @@ using namespace Ice;
using namespace Freeze;
using namespace std;
-
Freeze::TransactionPtr
Freeze::ConnectionI::beginTransaction()
{
@@ -25,13 +24,12 @@ Freeze::ConnectionI::beginTransaction()
Freeze::TransactionIPtr
Freeze::ConnectionI::beginTransactionI()
{
- if(_transaction != 0)
+ if(_transaction)
{
throw TransactionAlreadyInProgressException(__FILE__, __LINE__);
}
closeAllIterators();
_transaction = new TransactionI(this);
- _transaction->internalIncRef();
return _transaction;
}
@@ -44,7 +42,7 @@ Freeze::ConnectionI::currentTransaction() const
void
Freeze::ConnectionI::close()
{
- if(_transaction != 0)
+ if(_transaction)
{
try
{
@@ -56,7 +54,7 @@ Freeze::ConnectionI::close()
// Ignored
//
}
- assert(_transaction == 0);
+ assert(!_transaction);
}
while(!_mapList.empty())
@@ -65,7 +63,6 @@ Freeze::ConnectionI::close()
}
_dbEnv = 0;
-
}
CommunicatorPtr
@@ -80,18 +77,15 @@ Freeze::ConnectionI::getName() const
return _envName;
}
-
Freeze::ConnectionI::~ConnectionI()
{
close();
}
-
Freeze::ConnectionI::ConnectionI(const SharedDbEnvPtr& dbEnv) :
_communicator(dbEnv->getCommunicator()),
_dbEnv(dbEnv),
_envName(dbEnv->getEnvName()),
- _transaction(0),
_trace(_communicator->getProperties()->getPropertyAsInt("Freeze.Trace.Map")),
_txTrace(_communicator->getProperties()->getPropertyAsInt("Freeze.Trace.Transaction")),
_deadlockWarning(_communicator->getProperties()->getPropertyAsInt("Freeze.Warn.Deadlocks") != 0)
@@ -121,17 +115,14 @@ Freeze::ConnectionI::unregisterMap(MapHelperI* m)
}
Freeze::ConnectionPtr
-Freeze::createConnection(const CommunicatorPtr& communicator,
- const string& envName)
+Freeze::createConnection(const CommunicatorPtr& communicator, const string& envName)
{
return new ConnectionI(SharedDbEnv::get(communicator, envName, 0));
}
Freeze::ConnectionPtr
-Freeze::createConnection(const CommunicatorPtr& communicator,
- const string& envName,
- DbEnv& dbEnv)
+Freeze::createConnection(const CommunicatorPtr& communicator, const string& envName, DbEnv& dbEnv)
{
return new ConnectionI(SharedDbEnv::get(communicator, envName, &dbEnv));
}