diff options
author | Bernard Normier <bernard@zeroc.com> | 2007-05-30 13:18:35 +0000 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2007-05-30 13:18:35 +0000 |
commit | cd8abbb04a79b0d93f34742c49b06607e4e989f7 (patch) | |
tree | fabe04903dac6bd3ecf2ac6f3248ab5c22300fa7 /java/src/Freeze/SharedDbEnv.java | |
parent | fix problem with possible use of uninitialized local variable (diff) | |
download | ice-cd8abbb04a79b0d93f34742c49b06607e4e989f7.tar.bz2 ice-cd8abbb04a79b0d93f34742c49b06607e4e989f7.tar.xz ice-cd8abbb04a79b0d93f34742c49b06607e4e989f7.zip |
Removed transactional evictor context
Diffstat (limited to 'java/src/Freeze/SharedDbEnv.java')
-rw-r--r-- | java/src/Freeze/SharedDbEnv.java | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/java/src/Freeze/SharedDbEnv.java b/java/src/Freeze/SharedDbEnv.java index 11233f95536..35940fc9425 100644 --- a/java/src/Freeze/SharedDbEnv.java +++ b/java/src/Freeze/SharedDbEnv.java @@ -205,49 +205,49 @@ class SharedDbEnv implements com.sleepycat.db.ErrorHandler, Runnable // - // Get/create an evictor context associated with the calling thread + // Create an evictor context associated with the calling thread // - synchronized TransactionalEvictorContextI - getOrCreateCurrent(Ice.BooleanHolder created) + synchronized TransactionalEvictorContext + createCurrent() { - if(created != null) - { - created.value = false; - } - Object k = Thread.currentThread(); - TransactionalEvictorContextI ctx = (TransactionalEvictorContextI)_ctxMap.get(k); - if(ctx == null) - { - ctx = new TransactionalEvictorContextI(this); - - if(created != null) - { - created.value = true; - } - _ctxMap.put(k, ctx); - } + TransactionalEvictorContext ctx = (TransactionalEvictorContext)_ctxMap.get(k); + assert ctx == null; + + ctx = new TransactionalEvictorContext(this); + _refCount++; // owned by the underlying ConnectionI + _ctxMap.put(k, ctx); + return ctx; } - synchronized TransactionalEvictorContextI + synchronized TransactionalEvictorContext getCurrent() { Object k = Thread.currentThread(); - return (TransactionalEvictorContextI)_ctxMap.get(k); + return (TransactionalEvictorContext)_ctxMap.get(k); } - // - // Clear evictor context associated with the calling thread - // synchronized void - clearCurrent(TransactionalEvictorContextI oldCtx) + setCurrentTransaction(Transaction tx) { - Object removedCtx = _ctxMap.remove(Thread.currentThread()); - assert removedCtx == oldCtx; - } + Object k = Thread.currentThread(); + if(tx != null) + { + TransactionalEvictorContext ctx = (TransactionalEvictorContext)_ctxMap.get(k); + if(ctx == null || !tx.equals(ctx.transaction())) + { + ctx = new TransactionalEvictorContext((TransactionI)tx); + _ctxMap.put(k, ctx); + } + } + else + { + _ctxMap.put(k, null); + } + } private SharedDbEnv(MapKey key, com.sleepycat.db.Environment dbEnv) |