[ZODB-Dev] ZODB4 project plan

Shane Hathaway shane@zope.com
Tue, 03 Dec 2002 12:23:14 -0500


> On Tue, Dec 03, 2002 at 11:07:32AM -0500, Shane Hathaway wrote:
>>The Connection class now has a method setLocalTransaction().
>>(Suggestions for a better method name accepted.)  Once your app calls
>>this, your app is expected to use connection.getTransaction() or
>>ob._p_jar.getTransaction() instead of the get_transaction() function
>>to commit or abort the transaction.  Doing this enables your
>>application to have multiple writable connections open in a single
>>thread, which is especially usefully in GUI applications.
                               ^^^^^^^^

(Note to self: this is grammatically incorrectly. :-) )

Christian Reis wrote:
> Do many apps (Zope?) use multiple connections? Do they share connections
> between threads? I'm wondering how much impact changing the default
> would be. AAR, this works perfectly for me, cool.

Zope uses many connections and never shares them between threads.  Lots 
of Zope add-ons depend on get_transaction().  In fact, all existing ZODB 
applications expect the current policy.  I don't think we need to change 
the default policy.

BTW, ZODB connections are not at all thread safe.  This change has a 
side effect of enabling you to share a connection between threads, but I 
suspect you'll be very sorry if you do.  Don't try it. ;-)

Shane