summaryrefslogtreecommitdiff
path: root/cpp/src/Freeze/SharedDbEnv.cpp
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2007-06-01 23:01:01 +0000
committerBernard Normier <bernard@zeroc.com>2007-06-01 23:01:01 +0000
commitaba428c2e21eb34f8580804d471c19a208c8c813 (patch)
treeea0a9510a719b9e189eeddfebf0bf425075d1176 /cpp/src/Freeze/SharedDbEnv.cpp
parentReplace isMulticast with macro (diff)
downloadice-aba428c2e21eb34f8580804d471c19a208c8c813.tar.bz2
ice-aba428c2e21eb34f8580804d471c19a208c8c813.tar.xz
ice-aba428c2e21eb34f8580804d471c19a208c8c813.zip
More transactional evictor testing
Diffstat (limited to 'cpp/src/Freeze/SharedDbEnv.cpp')
-rw-r--r--cpp/src/Freeze/SharedDbEnv.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/cpp/src/Freeze/SharedDbEnv.cpp b/cpp/src/Freeze/SharedDbEnv.cpp
index de30521dfbe..1c54afbce7c 100644
--- a/cpp/src/Freeze/SharedDbEnv.cpp
+++ b/cpp/src/Freeze/SharedDbEnv.cpp
@@ -266,6 +266,28 @@ Freeze::SharedDbEnv::getCurrent()
void
Freeze::SharedDbEnv::setCurrentTransaction(const Freeze::TransactionPtr& tx)
{
+ TransactionIPtr txi;
+
+ if(tx != 0)
+ {
+ txi = Freeze::TransactionIPtr::dynamicCast(tx);
+
+ //
+ // Verify it points to the good DbEnv
+ //
+ if(txi->getConnectionI() == 0 || txi->getConnectionI()->dbEnv() == 0)
+ {
+ throw DatabaseException(__FILE__, __LINE__, "invalid transaction");
+ }
+
+ if(txi->getConnectionI()->dbEnv().get() != this)
+ {
+ throw DatabaseException(__FILE__, __LINE__, "the given transaction is bound to environment '" +
+ txi->getConnectionI()->dbEnv()->_envName + "'");
+ }
+ }
+
+
Freeze::TransactionalEvictorContextPtr ctx = getCurrent();
if(ctx != 0)
@@ -278,9 +300,9 @@ Freeze::SharedDbEnv::setCurrentTransaction(const Freeze::TransactionPtr& tx)
if(tx != 0)
{
- if(ctx == 0 || ctx->transaction().get() != tx.get())
+ if(ctx == 0 || ctx->transaction().get() != txi.get())
{
- ctx = new TransactionalEvictorContext(TransactionIPtr::dynamicCast(tx));
+ ctx = new TransactionalEvictorContext(txi);
#ifdef _WIN32
if(TlsSetValue(_tsdKey, ctx.get()) == 0)