directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Lamb <...@sleepycat.com>
Subject Re: [bdbje] Using a ThreadLocal to find a Transaction
Date Fri, 16 Apr 2004 19:03:21 GMT
Alex Karasulu wrote:

>It might be nice not to have to worry about providing the Transaction 
>which can be checked for by the JE method itself using the ThreadLocal.
>There is nothing stopping me from doing this myself in those classes 
>that make the calls to JE but I just thought I'd see if you guys 
>thought of it and if so why it's not used.  I'm sure the idea must 
>have occurred at some point.
>
Hi Alex,

Briefly, this is a good idea.

More details.

If you use the Collections API, there is already the notion of a current 
transaction.

If you use the "base API" (which I think you're doing), there is no such 
notion of current transaction as you correctly point out.  Certainly 
using ThreadLocal is an option and I'm going to think carefully about 
that.  One thing that comes to mind is how we specify to use ThreadLocal 
in the API.  Currently, passing null as the txn parameter means Auto 
Commit.  We could theoretically overload the null txn parameter to mean 
"use a threadlocal if it's there [i.e. previously specified through some 
other API call], and if not, then this call is AutoTxn".  There are, of 
course, issues in maintaining compatibility with the BDB API.

Thanks for your feedback.

Charles Lamb




Mime
View raw message